By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

ModalPopUpExtender

P: 10
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 ModalPopUpExtender control which I have declared in teh following way:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
  4.             PopupControlID="Panel1" 
  5.             TargetControlID="Button1"
  6.             BackgroundCssClass="modalBackground" 
  7.             OkControlID="OkButton"
  8.             OnOkScript="onOk()"
  9.             CancelControlID="CancelButton" 
  10.             DropShadow="true"/>
  11.  

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

Expand|Select|Wrap|Line Numbers
  1.  
  2. protected void Page_LoadComplete(object sender, EventArgs e)
  3.     {
  4.  
  5.         ModalPopupExtender1.Show(); //show the dialog box in which trhe user needs to enter their user name and password
  6. }
  7.  
The ModalPopUpExtender 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
Expand|Select|Wrap|Line Numbers
  1.  
  2.  protected void OkButton_Click(object sender, EventArgs e)
  3.     {
  4.        //here is where I am planning to do the Database checking stuff
  5.     }
  6.  

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 ModalPopUpExtender I have the following

OnOkScript="onOk()"

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
Mar 28 '07 #1
Share this Question
Share on Google+
2 Replies


P: 10
Hey Everyone,

I have a ModalPopUpextender 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 ModalPopUpExtender 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
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  function test()
  4.     {
  5.        var password = document.getElementById('ctl00_ContentPlaceHolder1_txtPassword').value;
  6.        var username = document.getElementById('ctl00_ContentPlaceHolder1_txtUserName').value;
  7.        var response = _Default.Connect(username,password);
  8.        if(response.value==1) //successful response
  9.        {
  10.  
  11.        }
  12.        else
  13.        {
  14.          alert("The Specified User Name or Password are invalid");
  15.  
  16.          //Below is what I've tried so far and is not working.
  17.         //$find("OrderDetailClient").show();
  18.         // $object('ModalPopupExtender1')._show();
  19.         //$object('ModalPopupExtender1').show();
  20.             $object('ModalPopupExtender')._show();             
  21.             Sys.Application.load.add(showPanel);            
  22.  
  23.        }
  24.     }
  25.  
  26. <div id="PanelInfo">
  27.    <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup" >
  28.      <table>
  29.        <tr>
  30.          <td><asp:Label runat="server" ID="lblUserName" Text="User Name:"/></td>
  31.          <td><asp:TextBox runat="server" ID="txtUserName" /></td>
  32.        </tr> 
  33.        <tr>
  34.          <td><asp:Label runat="server" ID="lblPassword" Text="Password:"/></td>
  35.          <td><asp:TextBox runat="server"  ID="txtPassword" TextMode="Password" /></td>
  36.        </tr>
  37.        <tr>     
  38.          <td>
  39.              <input id="OKButton" type="button" value="OK" onclick="test()" style="width: 53px"  /></td>
  40.          <td></td>
  41.        </tr>
  42.     </table>       
  43.   </asp:Panel>
  44.  
  45.  
  46.  
  47. <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
  48.             TargetControlID="Button1"
  49.             PopupControlID="Panel1" 
  50.             BackgroundCssClass="modalBackground" 
  51.             OkControlID="OkButton"
  52.             DropShadow="true"
  53.             PopupDragHandleControlID="Panel3" BehaviorID="OrderDetailClient" />
  54.  
  55.  

Thanks very much in advance

Susan
Mar 30 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Threads merged.
Mar 30 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.