Click here to Skip to main content
16,019,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
2nd dropdown value not selected when I remove alert message
and if I use javascript alert() after first dropdown selection then value will be selected

My problem is that I have used following code

JavaScript
$.ajax({
              cache: false,
              type: "POST",
              url:Url.Action("controller","view")
           
              data: { QueryId": QueryID
              },
              success: function (data)
{
document.getElementById(ddlTableName).value = "sometext";
document.getElementById(ddlTableName).onchange();
FillColumnDropDown(document.getElementById(ddlTableName)); //fill 2 nd dropdown
alert("h");
document.getElementById("Select1").text ="MyText"
},
error: function (xhr, ajaxOptions, thrownError) {
alert('Failed to retrieve Master Values.');
}
});


I have already used jquery like but problem still not solved
JavaScript
$("#" + ddlCondition + " option[value='" + data[i].Condition + "']").attr("selected", "selected");
Posted
Updated 16-May-13 3:28am
v2
Comments
Adam R Harris 16-May-13 12:31pm    
what happens inside FillColumnDropDown? is that an ajax post too?
ram salunke 17-May-13 0:41am    
FillColumnDropDown() is method which populate 2nd dropdown
then i am trying to select their value and also 2nd dropdown is populated there is no issue of populating..
my problem is 2nd dropdown value not select when i remove alert message from overthere
and if i put alert message 2nd dropdown vale will be selecting

thank you sir
Adam R Harris 17-May-13 0:43am    
Is it doing an ajax call? the reason i ask is, if removing your alert causes it to break it might be a timing thing with the ajax which could be the problem.
Mohibur Rashid 16-May-13 21:08pm    
what does Url.Action do?
ram salunke 17-May-13 0:42am    
Url.Action is calling to mvc controller
thank you sir..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900