Ajax UpdatePanel中的RadioButton [英] RadioButton inside Ajax UpdatePanel

查看:91
本文介绍了Ajax UpdatePanel中的RadioButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个与不同控件关联的单选按钮.一个带有选中的列表框,另一个带有文本框.为了处理AJAX中的单选按钮,我将它们放在了更新面板中.总的来说,我在updatepanel中放置了一个带有2个单选按钮,1个选中的列表框,1个文本框和2个按钮的表.通过这种方法,单选按钮可以正常工作,但是普通按钮停止工作.

请在下面找到代码:

Hi I have two radio buttons associated with different controls..one with a checked list box and other with a text box. To handle the radio buttons in AJAX, I placed them inside update panel. Overall I placed a table with 2 radio buttons, 1 checked list box, 1 textbox and 2 buttons inside updatepanel. With this approach the radio buttons are working well, but the normal buttons stopped working.

Please find the code below:

<asp:Panel ID="SelectAttributesPanel" runat="server" Width="230px" BackColor="#F0F8FF" BorderColor="Black" BorderWidth="1" Font-Names="Verdana" Font-Size="X-Small" onprerender="SelectAttributesPanel_PreRender">
 <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
 <ContentTemplate>
 <table style="width: 114%; color: #000000;">
 <tr bgcolor="#00CCFF"><td align="left" valign="middle">
 <asp:RadioButton ID="rdSelectAttribs" runat="server" AutoPostBack="True"

Text="Display Exploded View Graph based on the attributes selected below" GroupName="CHOICE" Font-Bold="True" Font-Names="verdana" ForeColor="White" Checked="True" Font-Size="Small" oncheckedchanged="rdSelectAttribs_CheckedChanged" />
</td></tr> <tr><td align="left" valign="middle">
 <asp:CheckBoxList ID="chklstAttributes" runat="server" Font-Names="Verdana" Font-Size="X-Small">
 </asp:CheckBoxList>
</td></tr> <tr bgcolor="#00CCFF"><td align="left" valign="middle">
 <asp:RadioButton ID="rdBaseline" runat="server" AutoPostBack="True"

Text="Display Exploded View Graph based on the RNC Count" GroupName="CHOICE" Font-Bold="True" Font-Names="verdana" ForeColor="White" Font-Size="Small" oncheckedchanged="rdSelectAttribs_CheckedChanged" />
 </td></tr>
<tr><td align="left" valign="middle" style="font-family: verdana; font-size: small;">RNC Count Baseline&nbsp;
 <asp:TextBox ID="txtRNCCountBaseline" runat="server" onKeyPress="return numbersonly(event, false)"

 BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="X-Small" MaxLength="3" Width="26px" EnableViewState="False">50</asp:TextBox></td></tr> <tr><td align="center">
 <asp:Button ID="btnOKSelectAttributes" runat="server" Text="OK" BorderStyle="Solid" BorderWidth="1px"

Font-Bold="True" Font-Size="Small" EnableViewState="False" onclick="btnOKSelectAttributes_Click" CausesValidation="False" Font-Names="verdana" />&nbsp; <asp:Button ID="btnCancelSelectAttributes" runat="server" Text="Close" Font-Bold="True" Font-Size="Small" EnableViewState="False" BorderStyle="Solid" BorderWidth="1px" Font-Names="verdana" />
 </td></tr>
 </table>
 </ContentTemplate>
 <Triggers>
 <asp:AsyncPostBackTrigger ControlID="rdSelectAttribs" EventName="CheckedChanged" />
 <asp:AsyncPostBackTrigger ControlID="rdBaseline" EventName="CheckedChanged" />
 </Triggers>
 </asp:UpdatePanel> </asp:Panel>



在单选按钮中,选中已更改的事件,我启用/禁用选中列表框和文本框.他们工作正常.但是确定"和关闭"按钮事件并未触发.是什么问题?



In the radio button checked changed events, I enable/disable the checkedlistbox and textbox. They are working fine. But the Ok and Close button events are not firing. What is the problem??

推荐答案

感谢您的答复.
我通过将确定"和取消"按钮放在单独的UpdatePanels中来使其工作.但是,我仍然不明白为什么它不能在单个UpdatePanel中工作.
Thank you for your reply.
I got it working by placing the OK and Cancel buttons in separate UpdatePanels. But, I still could not understand why it did not work in a single UpdatePanel.



我看不到您的关闭按钮有任何事件.但是错误是您需要在触发器下添加确定/关闭"按钮事件,否则其他明智的更新面板将不会做出响应.您的触发代码应如下所示
Hi,
I don''t see any event for your close button. However the error is you need to add ok/close button event under trigger, other wise update panel wont response accordingly. Your trigger code should look like this
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rdSelectAttribs" EventName="CheckedChanged" />
<asp:AsyncPostBackTrigger ControlID="rdBaseline" EventName="CheckedChanged" />
<asp:AsyncPostBackTrigger ControlID="btnOKSelectAttributes" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnCancelSelectAttributes" EventName="Click" />
 </Triggers>





希望对您有所帮助





Hope this will help


这篇关于Ajax UpdatePanel中的RadioButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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