带AsyncPostBackTrigger的RadioButtonList不起作用 [英] RadioButtonList with AsyncPostBackTrigger does not work

查看:71
本文介绍了带AsyncPostBackTrigger的RadioButtonList不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图使用radiobutton列表的选择事件导致部分回发,但它会导致完全回发。知道为什么会发生这种情况吗?

我以为我能够获得部分回发时间;

1)控件位于更新面板内

2)控件的AutoPostback ='true'

3)控件有AsyncPostBackTrigger

4)更新面板的UpdateMode =有条件的



文本框的文本更改事件发生部分回发,但单击单选按钮列表项时发生完全回发。



这里是aspx文件的示例;



Hi,
I am trying to cause a partial postback using the radiobutton list's selection event but it causes full postback. Any idea why this could be happening?
I thought I would be able to get partial postback when;
1) The control is inside the Update Panel
2) The control's AutoPostback='true'
3) The control has AsyncPostBackTrigger
4) Update panels' UpdateMode="Conditional"

Partial postback occurs for the text box's text changed event but Full postback occurs when i click the radio button list item.

Here is the example of the aspx file;

<ajaxToolkit:AccordionPane ID="AccordionCommodityInfo" runat="server">
                <Header>Commodity(ies)</Header>
               <Content>
                 <asp:UpdatePanel ID="UpdatePanelCommodity" runat="server" UpdateMode="Conditional">


                  <ContentTemplate>




<asp:RadioButtonList ID="rdHousehold" RepeatDirection="Horizontal"  OnSelectedIndexChanged ="rdHousehold_SelectedIndexChanged" AutoPostBack="true" runat="server">
                          <asp:ListItem Text ="Yes" Value="Y"  />
                          <asp:ListItem Text ="No" Value="N" />
                       </asp:RadioButtonList>




<asp:TextBox ID="txtScheduleB" runat="server" AutoPostBack="true"  OnTextChanged ="txtScheduleB_textChanged" style="display:none;" Width="256px" ></asp:TextBox>




</ContentTemplate>
                    <Triggers>
                     <asp:AsyncPostBackTrigger ControlID="txtScheduleB" />
                   </Triggers>

                   <Triggers>
                     <asp:AsyncPostBackTrigger ControlID="rdHousehold" EventName="SelectedIndexChanged"  />
                   </Triggers>

               </asp:UpdatePanel>
              </Content>
           </ajaxToolkit:AccordionPane>

推荐答案

刚刚发现我必须在Radiobutton列表中添加ClientIDMode =Auto并且它有效。

我不明白为什么我必须这样做,但它有效...
Just found out that I had to add ClientIDMode="Auto" to the Radiobutton list and it worked.
I don't understand why I had to, but it works...


这篇关于带AsyncPostBackTrigger的RadioButtonList不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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