How to fire dropdownlist's SelectedIndexChanged without postback?
I'开发者_如何学Gove got a DropDownList on my page databound to a query from my database (Databinding is set up only in my .aspx file, not in codebehind). Next to it I have a second DDL that gets populated from the SelectedIndexChanged function of the first one. This works, but only when AutoPostback is set to true.
Is there a way to fire the SelectedIndexChanged event or manually call this function in my codebehind without having to reload the page every time?
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
Your Stuff with OnSelectedIndexChanged in codebehind
</ContentTemplate>
</asp:UpdatePanel>
Rul easy
I would put the DDLs inside an AJAX UpdatePanel
so it only updates that part of the page instead of a full page reload.
Attach to the <select />
element's onChange
event a JavaScript function, and do an AJAX request to a webservice.
精彩评论