gpt4 book ai didi

c# - 更新面板触发器错误。无法在 UpdatePanel 中的触发器的关联控件上找到事件

转载 作者:太空狗 更新时间:2023-10-30 00:51:49 29 4
gpt4 key购买 nike

我在使用 ASP.NET WebForms 的 asp:UpdatePanel 和触发器时遇到问题。触发器在我的 UpdatePanel 上找不到事件。我看过很多示例,我复制了它们的实现,但无法正确执行。我是 WebForms 的新手。请帮忙。谢谢。

                <tr>
<td class="label1">Will use ETL?</td>
<td>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="updatePanel1">
<ContentTemplate>
<asp:RadioButtonList ID="useEtl" runat="server" RepeatDirection="Horizontal" Width="120" OnSelectedIndexChanged="useEtl_SelectedIndexChanged">
<asp:ListItem Text="Yes" Value="1" />
<asp:ListItem Text="No" Value="0" />
</asp:RadioButtonList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td class="label1">ETL Box</td>
<td>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="updatePanel2">
<ContentTemplate>
<asp:TextBox ID="etlBox" runat="server"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="useEtl" EventName="OnSelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>

最佳答案

按如下方式更改您的代码:

<asp:AsyncPostBackTrigger ControlID="useEtl" EventName="SelectedIndexChanged" />

您提到的事件名称是错误的,这是无法正常工作的原因。

你也可以试试下面的代码

UpdatePanel1.Triggers.Add(new AsyncPostBackTrigger()
{
ControlID = useEtl,
EventName = "SelectedIndexChanged", // this may be optional
}

关于c# - 更新面板触发器错误。无法在 UpdatePanel 中的触发器的关联控件上找到事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24870654/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com