I am building up my dropdown (asp.net dropdown) from a response object I get off a Combobox ( asp.net telerik combobox )

        var theName = response.value.Names;
        var theVal = response.value.Values;

    var theCode = '<select name = "my_dropdown"><option>Select Id : </option>';

    for(i = 1 ; i < (theName.length-1) ; i++) {
        theCode += '<option value="' + theVal[i] + '">' + theName[i] + '</option>';

    theCode += '</select>';


On a page refresh , The dropdown loses it's scope and goes back to being blank until another item in the combobox (which is generating the response object) is selected .

I want it to retain the last list of object if a page reload happens. I am looking for a jquery solution.

The above piece of Jquery is being run when the 1st combobox changes selected item. I hope I've explained myself in a proper way. I've looked into this solution Keep the selected value after submit - Stackoverflow question but I'm not sure where to call it as my dropdown is being generated dynamically.

Related posts

Recent Viewed