开发者

How can I refresh a dropdownlist during an event of another dropdownlist without refreshing whole web page?

I am developing my first asp.net website, my requirement is to refresh DropDownListB at SelectedIndexChanged event of DropDownListA, I have set AutoPostBack="True" for DropDownListA. Now the problem is who开发者_Go百科le web page gets refreshed, its unnecessary for me, is there any other technique that i can use to refresh only that control or only that panel rather than refreshing whole page?


Put the dropdowns inside

 <asp:UpdatePanel ID="up1" runat="server">
                        <ContentTemplate>
// Dropdowns
</ContentTemplate> 
      </asp:UpdatePanel>

and include <asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager> at the top


1- You can simply place the dropdown in an UpdatePanel, this will avoid a complete post back.

You can get more details on UpdatePanel here

2- You can use jQuery AJAX to fetch the data in JSON format and bind it to the dropdown list, this approach is more efficient but little complex in comparison to UpdatePanel

You can find so many articles on this if you search this on google , like

[EDIT]

You can find a similar implementation here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜