本文介绍了UpdatePanel问题.第一次使用“更新"面板AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友, 我在aspx页面中编写了以下代码:
Hello Friends, I have written a following code in my aspx page:
<asp:UpdatePanel runat="server" id="HoodUpdatePane" updatemode="Conditional"> <Triggers> <asp:AsyncPostBackTrigger ControlID="RBLstSeries" EventName="SelectedIndexChanged"/> </Triggers> <ContentTemplate> <asp:RadioButtonList ID="RBLstSeries" runat="server" onselectedindexchanged="RBLstSeries_SelectedIndexChanged"> <asp:ListItem Text="ELXC" Value="ELXC" Enabled="false"></asp:ListItem> <asp:ListItem Text="ELXC-UVi" Value="ELXC-UVi" Enabled="false"></asp:ListItem> <asp:ListItem Text="ELX" Value="ELX" Enabled="true" Selected="True"></asp:ListItem> <asp:ListItem Text="ELX-UVi" Value="ELX-UVi" Enabled="false"></asp:ListItem> <asp:ListItem Text="PG" Value="PG" Enabled="false"></asp:ListItem> <asp:ListItem Text="VH2" Value="VH2"></asp:ListItem> </asp:RadioButtonList> </ContentTemplate> </asp:UpdatePanel>但仍然在单选按钮上,单击返回整个页面..我是第一次使用AJAX,请帮助...代码中还需要添加其他内容吗?
but still on radio button click whole page post back..I m using AJAX first time,plz help...anything else has to be added in code?
推荐答案嘿, 将ur RBLstSeries的AutoPostback属性设置为true 或按照以下内容替换您的代码 Hey, set AutoPostback property true of ur RBLstSeries or replace ur code by following <asp:UpdatePanel runat="server" ID="HoodUpdatePane" UpdateMode="Conditional"> <ContentTemplate> <asp:RadioButtonList ID="RBLstSeries" runat="server" AutoPostBack="True" onselectedindexchanged="RBLstSeries_SelectedIndexChanged" > <asp:ListItem Text="ELXC" Value="ELXC" Enabled="false"></asp:ListItem> <asp:ListItem Text="ELXC-UVi" Value="ELXC-UVi" Enabled="false"></asp:ListItem> <asp:ListItem Text="ELX" Value="ELX" Enabled="true" Selected="True"></asp:ListItem> <asp:ListItem Text="ELX-UVi" Value="ELX-UVi" Enabled="false"></asp:ListItem> <asp:ListItem Text="PG" Value="PG" Enabled="false"></asp:ListItem> <asp:ListItem Text="VH2" Value="VH2"></asp:ListItem> </asp:RadioButtonList> <br /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> </asp:UpdatePanel>
并在aspx.cs页面中添加以下事件
and in aspx.cs page add following event
protected void RBLstSeries_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = "Post back Done"; }希望您的问题得到解决 祝你好运 快乐的编码
hope ur problem is solved best Luck happy coding
RBLstSeries是UpdatePanel的子级,您不需要为其添加AsyncPostBackTrigger.在UpdatePanel上设置ChildrenAsTriggers = true. RBLstSeries is a child of the UpdatePanel, you don''t need to add AsyncPostBackTrigger for it. Set ChildrenAsTriggers=true on the UpdatePanel.
请检查正在执行页面的浏览器.Googlechrome将不支持Ajax. 谢谢, 灰烬 Please check the browser in which you are executing your page.Google chrome wont support Ajax. Thanks, Ashish
更多推荐
UpdatePanel问题.第一次使用“更新"面板AJAX
发布评论