在Ajax中模型弹出扩展器 [英] Model Pop Up Extender In Ajax

查看:77
本文介绍了在Ajax中模型弹出扩展器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


asp.net ajax控件下的事件模型弹出扩展器未触发,请给我解决方法

Hi,
Event under asp.net ajax control Model pop up extender is not firing, plz give me the solution

推荐答案


请对您的问题进行更多描述
无论如何,我假设以下情况

1.在.aspx页面上单击一个按钮,但现在显示模式弹出窗口
2.您在面板内部有一个按钮,当激活模式弹出窗口时会显示该按钮,而单击该按钮不会触发该事件.

第1点的解决方案

ASPX页面:

Please be a little bit more descriptive about your question
Anyways, I am assuming the below scenarios

1. You click a button on the .aspx page but the modal popup is now shown
2. You have a button inside the panel which is shown when modal popup is active and that button when clicked does not fire the event.

Solution for point 1

ASPX Page:
//Normal Button
<asp:button runat="server" id="btnClickMe" text="Click Me" xmlns:asp="#unknown">
<asp:button runat="server" id="btnDummyClickMe" text="Click Me" style="display:none;" xmlns:asp="#unknown">

<cc1:modalpopupextender  runat="server" id="mpeShow" popupcontrolid="pnlPopup" targetcontrolid="btnDummyClickMe" ...="" xmlns:cc1="#unknown">


页面后面的代码


Code Behind Page

//Normal Button Click
protected void btnClickMe_Click(object sender, EventArgs e)
{
//do whatever operations you want to do
this.mpeShow.Show();
}


单击名为以下按钮的按钮时,将显示模式弹出窗口:单击Me

第2点的解决方案
通常,当您单击模式弹出面板中的按钮时,会触发该事件,但弹出窗口会消失.
举例来说,在显示的模式弹出窗口中,您有两个文本框和一个按钮.当您单击该按钮时,第一个文本框中的值需要复制到第二个文本框中.
为此,它与
相同的代码


This will show the modal popup when click on the button named: Click Me

Solution for point 2
It generally happens that when you click a button inside the modal popup panel, the event is fired but the popup disappears.
Say for example, in the modal popup shown, you have two textboxes and a button. When you click that button, value from the first text box needs to be copied over to second text box.
For this purpose, it is the same code as

this.TextBox2.Text = this.Textbox1.Text; 


但是,与此同时,您需要将该行包括为:
this.mpeShow.Show();

因此,步骤是在弹出面板内单击按钮:


But, along with this, you need to include the line as:
this.mpeShow.Show();

So the steps would be in the button click of a button inside the pop up panel:

//show the pop up
//type something in text box
//click the button
//do whatever operation you like to do
//show the popup again



希望这可以帮助.如果您有其他疑问,或者您认为我对问题的理解不同,请告诉我,我可以更好地解释.

-Nayan
编码是尘世间的天堂



Hope this helps. If you have any other questions in mind, or you think I understand the question differently, please let me know and I can explain better.

-Nayan
Coding is an earthly heaven


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Button ID="Btnshow" runat="server" Text="Show" OnClick="Btnshow_Click" />
        <asp:Button ID="BtnTarget" runat="server" Text="Target" Style="display: none" />
        <asp:TextBox ID="TextBox1" runat="server">
        </asp:TextBox>
        <input type="button" value="Get" onclick="abc()" />
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="BtnTarget"

            PopupControlID="Panel1">
        </asp:ModalPopupExtender>
        <asp:Panel ID="Panel1" runat="server" BackColor="Black" Width="300px" Height="300px">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Button ID="BtnHide" runat="server" Text="Hide Button" OnClick="BtnHide_Click" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="BtnHide" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
        </asp:Panel>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Btnshow" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>







protected void Btnshow_Click(object sender, EventArgs e)
  {
      ModalPopupExtender1.Show();
  }
  protected void BtnHide_Click(object sender, EventArgs e)
  {
      ModalPopupExtender1.Hide();
  }


这篇关于在Ajax中模型弹出扩展器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆