我正在尝试使用单选按钮列表来更改更新面板中的某些标签文本,但无论出于何种原因,SelectedIndexChanged事件似乎只在第一次触发,然后再也不会再触发。我用谷歌搜索和谷歌搜索,但我发现尝试的一切都没有运气解决问题。
Autopostback设置为true,我已经尝试了标准的.net ScriptManager和ToolkitScriptManager,两者都是相同的,我尝试在触发器中指定事件并且未指定它(这取决于默认值那个控件类型)...我也尝试将rbl绑定在一个if if.ispostback然后...结构中,用于页面加载事件。
我在事件中使用的VB只是一个简单的如果选择了这个索引,label.text =“whatever”else“yadda”......根本没什么特别的。如果更新面板不在播放中,这一切都很有效,除了我希望从完整的回发中摆脱屏幕闪光。我坚持吃肉和肉我的asp.net下面的土豆......帮助!
类型1 类型2 <asp:Panel ID="DesignInfoHeaderPanel" runat="server" CssClass="headerpanel">
<asp:Label ID="lblDesignInfo" runat="server" font-bold="true"
style="z-index: 1; left: 5px; top: 5px; position: absolute" Text="Design Information"></asp:Label>
</asp:Panel>
<div class="cpdiv">
<asp:Panel ID="DesignInfoPanel" runat="server" CssClass="collapsepanel">
<asp:UpdatePanel runat="server" ID="DIUpdatePanel" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" font-bold="true"
style="z-index: 1; left: 5px; top: 7px; width: 95px; position: absolute; text-align: right"
Text="Account Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Font-Names="Verdana" Font-Size="8pt"
style="z-index: 1; left: 110px; top: 4px; width: 144px; position: absolute"></asp:TextBox>
<asp:Label ID="Label2" runat="server" font-bold="true"
style="z-index: 1; left: 270px; top: 7px; width: 140px; position: absolute"
Text="Est. Volume (# units)"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" Font-Names="Verdana" Font-Size="8pt"
style="z-index: 1; left: 415px; top: 4px; width: 60px; position: absolute"></asp:TextBox>
<asp:Label ID="Label3" runat="server" font-bold="true"
style="z-index: 1; left: 7px; top: 35px; width: 95px; position: absolute; text-align: right"
Text="Sales Manager"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" Font-Names="Verdana" Font-Size="8pt"
style="z-index: 1; left: 110px; top: 32px; width: 150px; position: absolute">
</asp:DropDownList>
<asp:Label ID="Label4" runat="server" font-bold="true"
style="z-index: 1; left: 485px; top: 7px; width: 140px; position: absolute"
Text="Personalization Type"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" Font-Names="Verdana" Font-Size="8pt"
style="z-index: 1; left: 630px; top: 4px; width: 150px; position: absolute">
</asp:DropDownList>
<asp:CheckBox ID="CheckBox1" runat="server" font-bold="true"
style="z-index: 1; left: 298px; top: 32px; position: absolute" Text="Rental"
TextAlign="Left" />
<asp:CheckBox ID="CheckBox2" runat="server" font-bold="true"
style="z-index: 1; left: 397px; top: 32px; position: absolute" Text="Dir Sales"
TextAlign="Left" />
<asp:RadioButtonList ID="RadioButtonList1" runat="server" BorderColor="#640000"
BorderStyle="Solid" BorderWidth="2px" Font-Bold="true"
RepeatDirection="Horizontal"
style="z-index: 1; left: 545px; top: 28px; position: absolute"
TextAlign="Left">
<asp:ListItem Value="0">Type1</asp:ListItem>
<asp:ListItem Value="1">Type2</asp:ListItem>
</asp:RadioButtonList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rblEmblemType" />
</Triggers>
</asp:UpdatePanel>
答案 0 :(得分:0)
可能是因为UpdatePanel正在更新。由于您尚未发布有关您的代码脚本的任何信息,我假设您没有在事件方法中使用以下代码。
UpdatePanel1.Update()
这(下一个)可能发生的可能性较小。
如果使用AutoPostBack,则不需要使用asyncPostBackTrigger ..!当图像按钮/图像/网格...等事件发生时,或者发生此错误时,您需要使用触发器
无法解析从服务器收到的消息。
答案 1 :(得分:0)
尝试将ClientIDMode="AutoID"
添加到您的RadioButtonList。
答案 2 :(得分:0)
我的代码与您的代码非常相似。 在我的情况下,设置PostBackTrigger时会触发SelectedIndexChanged事件。 实际上,事件仅触发一次,这意味着单击事件会附加到其他单选按钮(未选中)上。 因此,我只是解决了删除“ Selected = true”