asp panel : How to make it pop up in the centre of the page when run

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpmel
    New Member
    • Oct 2007
    • 69

    asp panel : How to make it pop up in the centre of the page when run

    Hi Guys,

    I have an asp panel,an associated drag panel extender, a label and an OK button that serves as a message popup. i would like this pop up to show up in the centre of the browser window when the page is run.

    can someone please help me
    My code is below. i am using master pages

    Code:
    <asp:Panel ID="MessagePanel" runat="server" Style="z-index: 100;
    left: 50%; position: absolute; top: 50%;"  Visible="False" CssClass="modalPopup" Wrap="false">
                                <table>
                                    <tr>
                                        <td style="width: 100%; text-align: center">
                                <asp:Label ID="lblMessagePanel" runat="server"></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <td style="width: 100%; text-align: right">
                                <asp:Button ID="btnOkPanel" runat="server" OnClick="btnOkPanel_Click" Text="OK" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Font-Names="Arial" Font-Size="10pt" Width="38px" /></td>
                                    </tr>
                                </table>
                                <cc1:DragPanelExtender  DragHandleID="messagePanel" ID="DragPanelExtender1" runat="server" TargetControlID="MessagePanel">
                                </cc1:DragPanelExtender>
                            </asp:Panel>
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You'll have to write JavaScript that centers it in the middle of the page.
    You could look into using the Animation extender to help you do this.

    -Frinny

    Comment

    • phpmel
      New Member
      • Oct 2007
      • 69

      #3
      the pop up is just a sort of confirmation box that has a message and an ok button. Can you please elaborate or show me some kind of example

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by phpmel
        the pop up is just a sort of confirmation box that has a message and an ok button. Can you please elaborate or show me some kind of example

        When does your confirmation box appear?
        (This will determine how I answer your question)

        Comment

        • phpmel
          New Member
          • Oct 2007
          • 69

          #5
          I am adding data to a table in the code behind and then i attempt to set the text of the label in the panel to "The record was successfully saved" and then pop up the panel as a sort of message box.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by phpmel
            I am adding data to a table in the code behind and then i attempt to set the text of the label in the panel to "The record was successfully saved" and then pop up the panel as a sort of message box.

            Try following the example outlined in the Animation Sample found in the AjaxControlTool Kit Samples.

            Instead of using a regular AnimationExtend er you'll want to look into using the UpdatePanelAnim ation ...changing the Animation code to use the OnLoad instead of the OnClick.


            If this doesn't work for you, I'll help you write some JavaScript that changes the position of the panel (<div>) to be "absolute" and change the location of the panel to the center of your browser....(thi s version is not fun)

            Comment

            • kiran143
              New Member
              • Sep 2008
              • 2

              #7
              actually i have not tried panel but i have a javascript code

              function pop()
              {
              window.showModa lDialog(Name of the file to be opened as a POPUP.aspx',nul l,'status:no;di alogWidth: ;dialogHeight: ;dialogHide:tru e;help:no;scrol l:yes');
              }

              in page load Call the Java script

              ButtonId.Attrib utes.Add("OnCli ck", "javascript:pop ();");

              Comment

              Working...