gpt4 book ai didi

javascript - 试图使示例在 ModalPopup 中工作 : How to use ASP. NET AJAX UpdatePanel?

转载 作者:行者123 更新时间:2023-11-28 06:06:50 25 4
gpt4 key购买 nike

我发现这篇文章可以帮助我解决当前遇到的问题。问题是我很难让它发挥作用。文章为How to use ASP.NET AJAX UpdatePanel in ModalPopup

所以我创建了一个更简单的示例,但问题是 Label lblText 没有更新(它仍然是这是标签),即使代码隐藏由于遇到断点而正在执行。因此,我们非常感谢任何帮助。

这是标记:

<form id="form1" runat="server"> 
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="udpOutterUpdatePanel" runat="server">
<ContentTemplate>
<div id="divControlContainer" runat="server">
<asp:LinkButton ID="lbtnRed" runat="server" onclick="lbtnRed_Click">Red</asp:LinkButton>
</div>
<input id="dummy" type="button" style="display: none" runat="server" />
<ajaxToolkit:ModalPopupExtender runat="server"
ID="mpeThePopup"
TargetControlID="dummy"
PopupControlID="pnlModalPopUpPanel" />
<asp:Panel ID="pnlModalPopUpPanel" runat="server" style="border: 2px solid black; position:absolute; width:600px; height: 520px; display:none">
<asp:UpdatePanel ID="udpInnerUpdatePanel" runat="Server" UpdateMode="Conditional">
<ContentTemplate>
<p>
<asp:DropDownList ID="ddlProducts" runat="server"></asp:DropDownList>
&nbsp;
<asp:Button ID="btnChooseProduct" runat="server" Text="Choose" onclick="btnChooseProduct_Click"/>
&nbsp;
<asp:Button ID="btnCancelModalPopup" runat="server" Text="Cancel" />
</P>
<div style="width: 200px; border: 1px solid red">
<asp:Label ID="lblText" Text="this is the label" ForeColor="Black" runat="server"></asp:Label><br />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnChooseProduct" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>

隐藏代码:

protected void btnChooseProduct_Click(object sender, EventArgs e)
{
lblText.Text = "You have selected " + ddlProducts.SelectedItem.Text;
//Show ModalPopup
mpeThePopup.Show();
}

protected void lbtnRed_Click(object sender, EventArgs e)
{
ddlProducts.Items.Clear();

//Populate DropDownList Items
ddlProducts.Items.Add(new ListItem("Red Balloon", "Red Balloon"));
ddlProducts.Items.Add(new ListItem("Red Apple", "Red Apple"));
ddlProducts.Items.Add(new ListItem("Red Shirt", "Red Shirt"));
ddlProducts.Items.Add(new ListItem("Red Watch", "Red Watch"));
mpeThePopup.Show();

}

最佳答案

问题是我在 VS 2010 中引用了 AJAX Control Toolkit 3.5。我刚刚删除了该引用,下载并安装了 AjaxControlToolkit.dll 4.0,现在一切正常。

谢谢。

关于javascript - 试图使示例在 ModalPopup 中工作 : How to use ASP. NET AJAX UpdatePanel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36777746/

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