ModalPopupExtender

Discussion in 'ASP .Net' started by GaryDean, Dec 18, 2008.

  1. GaryDean

    GaryDean Guest

    After watching the video on the ModalPopupExtender from MSDN I designed a
    panel with some controls on it: A dropdown box, an ok button, a cancel
    button. Unfortunitely, the video only shows how to trigger client side
    javascript and not server side events(Grrrrrr). I supposed that I simply
    have to handle events from the controls on the panel.

    Well, when I change values in the dropdown, or push the buttons on the
    panel, the server side events do indeed trigger but the modal box goes
    away!! how can I keep it displayed until it is dismissed by, say, a button
    identified by the ModalPopupExtender OkControlId entry.

    The general idea here is that I want to have somewhat of a complex form on
    this panel with all sorts of controls. is this possible?
    Thanks,
    Gary
    GaryDean, Dec 18, 2008
    #1
    1. Advertising

  2. GaryDean

    bruce barker Guest

    the ModalPopupExtender is only a javascript visual effect (unhides a div). if
    you do a postback in it it postbacks. you make serverside call with the
    client ajax library. if you can not code javascript, you can also put an
    update panel inside the popup panel, and do an async postback.

    -- bruce (sqlwork.com)


    "GaryDean" wrote:

    > After watching the video on the ModalPopupExtender from MSDN I designed a
    > panel with some controls on it: A dropdown box, an ok button, a cancel
    > button. Unfortunitely, the video only shows how to trigger client side
    > javascript and not server side events(Grrrrrr). I supposed that I simply
    > have to handle events from the controls on the panel.
    >
    > Well, when I change values in the dropdown, or push the buttons on the
    > panel, the server side events do indeed trigger but the modal box goes
    > away!! how can I keep it displayed until it is dismissed by, say, a button
    > identified by the ModalPopupExtender OkControlId entry.
    >
    > The general idea here is that I want to have somewhat of a complex form on
    > this panel with all sorts of controls. is this possible?
    > Thanks,
    > Gary
    >
    >
    >
    bruce barker, Dec 18, 2008
    #2
    1. Advertising

  3. Hi Gary,

    What Bruce said is reasonable. Here's the code that demonstrates how to do
    this:

    aspx:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Label ID="Label2" runat="server" Text="Click Me to Show Popup
    Window!" BackColor="Yellow"></asp:Label>
    <cc1:ModalPopupExtender ID="Label2_ModalPopupExtender"
    runat="server"
    TargetControlID="Label2"
    OkControlID="Button3" DropShadow="true"
    PopupControlID="Panel1">
    </cc1:ModalPopupExtender>
    <asp:panel ID="Panel1" BackColor="Pink" runat="server"
    style="display:none;">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Button ID="Button2" runat="server" Text="Click Me"
    onclick="Button2_Click" />
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <br />

    </ContentTemplate>
    </asp:UpdatePanel>
    <asp:Button ID="Button3" runat="server" Text="OK" />

    </asp:panel>

    aspx.cs:

    protected void Button2_Click(object sender, EventArgs e)
    {
    this.Label1.Text = DateTime.Now.ToString();
    }

    The basic idea is to use UpdatePanel to do async postback.

    If you have further questions please feel free to ask.

    Regards,
    Allen Chen
    Microsoft Online Community Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support Engineer
    by contacting Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Allen Chen [MSFT], Dec 19, 2008
    #3
  4. Hi Gary,

    Do you have any progress on this issue?

    Regards,
    Allen Chen
    Microsoft Online Support
    Allen Chen [MSFT], Dec 25, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,292
  2. xeroxero
    Replies:
    0
    Views:
    759
    xeroxero
    Dec 7, 2006
  3. bruce barker

    Re: Open Modalpopupextender from javascript

    bruce barker, Dec 19, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,786
    bruce barker
    Dec 19, 2006
  4. Replies:
    1
    Views:
    1,646
    Bruce Barker
    Jan 8, 2007
  5. BillE
    Replies:
    2
    Views:
    480
    BillE
    Apr 11, 2007
Loading...

Share This Page