Reputation: 3864
I need to update my second drop down list from database according to the value selected from first drop down list in the Jquery dialog.
ASPX
<asp:UpdatePanel ID="upnl" OnLoad="upnl_Load" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="dv" style="display: none;" title="Tile">
<table>
<tr>
<td>Parent</td>
<td>
<asp:DropDownList ID="ddlDialog1" runat="server" /></td>
</tr>
<tr>
<td>Child</td>
<td>
<asp:DropDownList ID="ddlDialog2" runat="server" /></td>
</tr>
</table>
</div >
</ContentTemplate>
</asp:UpdatePanel>
JQuery
function ShowDialog() {
jQuery(document).ready(function () {
$("#dv").dialog({
draggable: true,
modal: true,
width: 500,
height: 400
});
});
}
jQuery(document).ready(function () {
$("#<%= ddlDialog1.ClientID %>").change(function () {
//This doesn't fire
__doPostBack('<%= upnl.ClientID %>', "DialogOnChange");
});
});
Problem here is, How to change function doesn't fire when I select different values from first drop down list(ddlDialog1).
Any idea?
Upvotes: 0
Views: 1555
Reputation: 143
This may help you.
$('#ddlDialog1').change(function(){
alert(Selected Value : + $('#ddlDialog1').val());
});
Upvotes: 0
Reputation: 3939
Since $("#dv").dialog();
make your document changed.
you have to bind $("#<%= ddlDialog1.ClientID %>")
after the dialog opened.
$("#dv").dialog({
//...,
open: function(){
//..bind item in this dialog
},
});
Upvotes: 1