asp.net - How can i fill a dropdown list before opening a jQuery dialog -


i have form lists bunch of links open basic documents, ie. pdf, docs, etc. on right side links have href link open jquery dialog details on each specific link, example, name of link, option upload new updated document etc. in dialog able have dropdown list holds sort order, list of numbers 1,2,3,4,5 etc. user can reorder links. best way fill form textboxes, dropdown lists (most important) needed data database , open jquery dialog. using jquery ajax , webservice fill textboxes fine, dropdown list getting filled after browser rendered. execute ajax call jquery button click event when user clicks on href tag lives on right side of each link. doesnt allow me grab selectedvalue on postback on save button click event updated values , update record. appreciated.

function loaddocumentsort(id, selectedsort) { $.ajax({     type: 'post',     url: baseurl + 'webservices.asmx/getsortcount',     data: json.stringify({ articleid: articleid }),     contenttype: "application/json; charset=utf-8",     datatype: 'json',      success: function (data) {          if (data.d != '') {              $("#uieditsort").empty();             var sortcount = data.d;              var listitems;             listitems = "<option value=''></option>";             (var = 1; < sortcount + 1; i++) {                   if (selectedsort == i) {                     listitems += "<option selected='true' value='" + + "'>" + + "</option>";                     //$("#uieditsort").append($("<option selected='true'><option />").val(i).text(i));                 }                 else {                     //$("#uieditsort").append($("<option><option />").val(i).text(i));                     listitems += "<option value='" + + "'>" + + "</option>";                 }             };              $("#uieditsort").html(listitems);         }     },     error: function (xhr, ajaxoptions, thrownerror) {         alert('error');     } }); 

the following solution make pseudo code

      $('#link').on("click",function(event){         $("#loadingdiv").html('loading ....').show();         $("#containerofcontrols").hide();         $("#dialogid").dialog('open');     //now make first ajax call     $.ajax({      url: '',      success : function(result){                 //populate textbox , make ajax call                   $.ajax({                   url : '',                    success : function(result){                                 //populate dropdown                                   $("#loadingdiv").hide();                                    $("#containerofcontrols").show();                                }                          }}}}); 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -