如何防止下拉列表事件在asp.net中的页面刷新? [英] how to prevent page refresh in asp.net on dropdown list event?

查看:101
本文介绍了如何防止下拉列表事件在asp.net中的页面刷新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发我的asp.net网站,我的要求是在DropDownList1的SelectedIndexChanged事件上刷新DropDownList2,我已设置

I am developing my asp.net website, my requirement is to refresh DropDownList2 at SelectedIndexChanged event of DropDownList1, I have set

AutoPostBack="True"

用于DropDownList1.现在的问题是整个网页都被刷新了,这对我来说是不必要的,是否有什么其他技术可以用来仅刷新该控件或该面板而不是刷新整个页面?

for DropDownList1. Now the problem is whole 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?

推荐答案

hi,

尝试使用UpdatePanel:

http://ajax.net-tutorials.com/controls/updatepanel-control/ [ ^ ]

http://msdn.microsoft.com/en-us/library/system. web.ui.updatepanel.aspx [ ^ ]

http://msdn.microsoft.com/en-us/library/bb399001.aspx [ ^ ]

问候
罗伯特


try to user UpdatePanel:

http://ajax.net-tutorials.com/controls/updatepanel-control/[^]

http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx[^]

http://msdn.microsoft.com/en-us/library/bb399001.aspx[^]

Regards
Robert


在此之间编写代码

Write the code between this

<asp:ScriptManager ID="ScriptManager1" runat="server" />
       <asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">

           <ContentTemplate>

           </ContentTemplate>
             <Triggers>
         <asp:Asyncpostbacktrigger controlid="DropDownList2" eventname="SelectedIndexChanged" />
       </Triggers>
       </asp:UpdatePanel>


这篇关于如何防止下拉列表事件在asp.net中的页面刷新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆