ModalPopUpExtender

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suzi167
    New Member
    • Feb 2007
    • 10

    ModalPopUpExtender

    Hello Everyone,

    I am having the following issue.

    I have an AJAX enabled Web Application in C#.
    I am using a Master Page and then I have a Default.aspx page which is based on the Master page.
    In my Default.aspx page I am using a ModalPopUpExten der control which I have declared in teh following way:
    Code:
    
    <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
                PopupControlID="Panel1" 
                TargetControlID="Button1"
                BackgroundCssClass="modalBackground" 
                OkControlID="OkButton"
                OnOkScript="onOk()"
                CancelControlID="CancelButton" 
                DropShadow="true"/>

    I need this to show when the page loads so I have the following code in my .cs file

    Code:
    protected void Page_LoadComplete(object sender, EventArgs e)
        {
          
            ModalPopupExtender1.Show(); //show the dialog box in which trhe user needs to enter their user name and password
    }
    The ModalPopUpExten der prompts the user to enter a user name and a password and then there are the OK and Cancel BUttons.

    And here is the issue:

    When the user clicks on the OK button I need to access a database and check to see if the spcified user exists in a Users Table.
    I know how to do all that....BUT
    I have the following routine in my Default.cs file and I though pressing on teh OK button will bring me to that routine
    Code:
     protected void OkButton_Click(object sender, EventArgs e)
        {
           //here is where I am planning to do the Database checking stuff
        }

    I put a break point at the beginning of the routine but unfortunately when I press the OK button the code does not go there.


    If you n otice however in my declaration of the ModalPopUpExten der I have the following

    OnOkScript="onO k()"

    so I have no problem acceessing the js function wen I click om the OK button.
    The question is however how can I get to any function and aceess the database when I click on the OK button.
    All I want to do is when the user clicks OK I want to access a table in the database and check against it.
    If this can be done in js then great but I don't know how to do it, otehrwise how can I access a functio in my C# code taht can do the same thing.

    Thanks very much

    Susan
  • suzi167
    New Member
    • Feb 2007
    • 10

    #2
    Show a ModalPopUpExten der

    Hey Everyone,

    I have a ModalPopUpexten der which shows up when teh page loads and I am usig it for the user to enter a username and password.

    If the pasword is incorrect however, once the user clicks on the OK button I want the ModalPopUpExten der to NOT go away.
    I tried many different things.
    How can I make the dialog box Show when I wanted it from Java Script.

    here is my code
    Code:
    
     function test()
        {
           var password = document.getElementById('ctl00_ContentPlaceHolder1_txtPassword').value;
           var username = document.getElementById('ctl00_ContentPlaceHolder1_txtUserName').value;
           var response = _Default.Connect(username,password);
           if(response.value==1) //successful response
           {
           
           }
           else
           {
             alert("The Specified User Name or Password are invalid");
             
             [B]//Below is what I've tried so far and is not working[/B].
            //$find("OrderDetailClient").show();
            // $object('ModalPopupExtender1')._show();
            //$object('ModalPopupExtender1').show();
                $object('ModalPopupExtender')._show();             
                Sys.Application.load.add(showPanel);            
        
           }
        }
    
    <div id="PanelInfo">
       <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup" >
         <table>
           <tr>
             <td><asp:Label runat="server" ID="lblUserName" Text="User Name:"/></td>
             <td><asp:TextBox runat="server" ID="txtUserName" /></td>
           </tr> 
           <tr>
             <td><asp:Label runat="server" ID="lblPassword" Text="Password:"/></td>
             <td><asp:TextBox runat="server"  ID="txtPassword" TextMode="Password" /></td>
           </tr>
           <tr>     
             <td>
                 <input id="OKButton" type="button" value="OK" onclick="test()" style="width: 53px"  /></td>
             <td></td>
           </tr>
        </table>       
      </asp:Panel>
    
    
    
    <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
                TargetControlID="Button1"
                PopupControlID="Panel1" 
                BackgroundCssClass="modalBackground" 
                OkControlID="OkButton"
                DropShadow="true"
                PopupDragHandleControlID="Panel3" BehaviorID="OrderDetailClient" />

    Thanks very much in advance

    Susan

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Threads merged.

      Comment

      Working...