AJAX工具包模式弹出不会出现 [英] AJAX Toolkit Modal Popup won't appear
问题描述
我有一些麻烦调用从服务器端模式弹出。所以,我设置了modalpopupextender的的TargetControlID一个隐藏的标签。然后从按钮的点击codebehind,我尝试添加this.modalpopup.show();不幸的是,当发生这种情况的模式弹出不会出现。我可以看到code得到执行,但没有显示。
下面是我的ASP。减去初始<为按钮和popupextender,因为某种原因,这些线路将不显示。
< ASP:按钮的CssClass =按钮ID =按钮=服务器文本=按钮ACCESSKEY =M荟萃:获取ResourceKey =buttonResource1的OnClick =button_Click/>< ajaxToolkit:ModalPopupExtender ID =MPE=服务器的TargetControlID =forpopup
PopupControlID =PopupPanelBackgroundCssClass =modalBackground/> < ASP:标签ID =forpopup=服务器可见=假>< / ASP:标签> < ASP:面板ID =PopupPanel=服务器边框=槽BORDERCOLOR =黑色边框宽度=的3px背景色=艾莉斯蓝HEIGHT =200像素WIDTH =200像素的风格=显示:无> < ASP:标签ID =lblPopup=服务器文本=!弹出>< / ASP:标签>< BR />
< BR />
< ASP:DropDownList的ID =ddlData=服务器>
< / ASP:DropDownList的>< BR />
< BR /> < ASP:按钮的ID =btnPopupOK=服务器文本=确定/>
< ASP:按钮的ID =btnPopupCancel=服务器文本=取消/>
< / ASP:面板>
和这里是我的codebehind
保护无效button_Click(对象发件人,EventArgs的发送)
{
this.mpe.Show();
}
我有一个类似的问题。我是在扩展的的TargetControlID设置为隐藏式按键,并试图触发展()事件在服务器端code。即使code被击中它没有被显示出来。我发现,问题是,我使用的visible = false不渲染该控件的页面隐藏的隐藏按钮。我把它改成了风格=显示:无',并开始工作。试着改变你的目标控制到一个隐藏按钮,并确保它越来越呈现(只是未显示),也许它会工作。
I'm having some trouble calling a modal popup from server side. So, I set the modalpopupextender's targetcontrolID to a hidden label. Then in the codebehind from a button's click, I try to add this.modalpopup.show(); Unfortunately, the modal popup doesn't appear when this happens. I can see the code get executed, but nothing shows.
Here's my ASP. minus the opening < for the button and popupextender, because for some reason those lines won't display.
<asp:Button CssClass="Button" ID="button" runat="server" Text="Button" AccessKey="m" meta:resourcekey="buttonResource1" OnClick="button_Click" />
<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlID="forpopup"
PopupControlID="PopupPanel" BackgroundCssClass="modalBackground" />
<asp:Label ID="forpopup" runat="server" Visible="False"></asp:Label>
<asp:panel id="PopupPanel" runat="server" BorderStyle="Groove" BorderColor="black" BorderWidth="3px" BackColor="AliceBlue" Height="200px" Width="200px" style="display: none">
<asp:Label ID="lblPopup" runat="server" Text="popup!"></asp:Label><br />
<br />
<asp:DropDownList ID="ddlData" runat="server">
</asp:DropDownList><br />
<br />
<asp:Button ID="btnPopupOK" runat="server" Text="Ok" />
<asp:Button ID="btnPopupCancel" runat="server" Text="Cancel" />
</asp:panel>
and here is my codebehind
protected void button_Click(object sender, EventArgs e)
{
this.mpe.Show();
}
I had a similar problem.. I was setting the targetcontrolid of the extender to a hidden button and trying to fire the Show() event in server side code. It wasn't being displayed even though the code was getting hit. I discovered that the problem was that I was hiding the hidden button using "visible = false" which doesn't render the control to the page. I changed it to "style='display:none'" and it started working. Try changing your target control to a hidden button and make sure it's getting rendered (just not shown) and maybe it will work.
这篇关于AJAX工具包模式弹出不会出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!