Modal Popup Extender:从数据库获取数据,然后将其绑定到 modalpopupextender 中的标签
我对 ModalPopupExtender 有疑问。我在 ModalPopupExtender 中放置了一个标签,并尝试将标签与数据库中的值绑定。当我调试时,该值显示在标签的文本上(即没有数据库错误),但在显示弹出窗口时不显示该值。
有谁可以帮帮我吗???????
这是我的代码
html 上的
<asp:Panel ID="PopupPnl" runat="server">
<table style="width:100%;">
<tr>
<td >
<asp:Label ID="Label2" runat="server"
Text="View Description" >
</asp:Label>
</td>
</tr>
<tr>
<td >
<asp:Label ID="label_Descrption" runat="server" >
</asp:Label>
</td>
</tr>
<tr style="background-color:White;">
<td >
<asp:Button ID="btnExit" runat="server" Text="Exit"/>
</td>
</tr>
</table>
</asp:Panel>
<asp:Button ID="btnShowPopup" runat="server"
style="display:none;"/>
<cc1:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
TargetControlID="btnShowPopup"
PopupControlID="PopupPnl"
CancelControlID="btnExit"
BackgroundCssClass="ModalPopupBG" >
</cc1:ModalPopupExtender>
代码 c# 上的代码
protected void lbn_Template_Click(object sender, EventArgs e)
{
util_Category objUtilCategory = new util_Category();
cl_Category objClCategory = new cl_Category();
if (ddlSubCategory.SelectedItem.Text != "--Select A SubCategory--")
{
objClCategory.CategoryId = Convert.ToInt32(ddlSubCategory.SelectedValue);
Label lbl = (Label)PopupPnl.FindControl("label_Descrption");
label_Descrption.Text = objUtilCategory.GetATemplate(objClCategory);
ModalPopupExtender2.Show();
}
}
I've a problem with ModalPopupExtender. I have put a label in ModalPopupExtender and trying to bind label with the value from database. When I am debugging, the value is showing on the label's text (ie there is no database error), but it is not displaying when the popup window is shown.
Can any one help me please ????????
Here's my code
Code on html
<asp:Panel ID="PopupPnl" runat="server">
<table style="width:100%;">
<tr>
<td >
<asp:Label ID="Label2" runat="server"
Text="View Description" >
</asp:Label>
</td>
</tr>
<tr>
<td >
<asp:Label ID="label_Descrption" runat="server" >
</asp:Label>
</td>
</tr>
<tr style="background-color:White;">
<td >
<asp:Button ID="btnExit" runat="server" Text="Exit"/>
</td>
</tr>
</table>
</asp:Panel>
<asp:Button ID="btnShowPopup" runat="server"
style="display:none;"/>
<cc1:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
TargetControlID="btnShowPopup"
PopupControlID="PopupPnl"
CancelControlID="btnExit"
BackgroundCssClass="ModalPopupBG" >
</cc1:ModalPopupExtender>
Code on c#
protected void lbn_Template_Click(object sender, EventArgs e)
{
util_Category objUtilCategory = new util_Category();
cl_Category objClCategory = new cl_Category();
if (ddlSubCategory.SelectedItem.Text != "--Select A SubCategory--")
{
objClCategory.CategoryId = Convert.ToInt32(ddlSubCategory.SelectedValue);
Label lbl = (Label)PopupPnl.FindControl("label_Descrption");
label_Descrption.Text = objUtilCategory.GetATemplate(objClCategory);
ModalPopupExtender2.Show();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将包含
label_Description
的Panel
放置在UpdatePanel
内。You need to place the
Panel
which contains thelabel_Description
insideUpdatePanel
.