473,383 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ModalPopUpExtender

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
2 8007
suzi167
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
16,027 Expert Mod 8TB
Threads merged.
Mar 30 '07 #3

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

Similar topics

0
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I have a web form, and I want to use ModalPopupExtender from Ajax Toolkit. I am using IE 7.0 as browser, VS 2005 and Ajax and Ajax Tool Kit installed. Windows XP Pro. Now I have a...
1
by: Victor | last post by:
Hi guys i have a strange problem about my modalpopupextender. In my page, i put a gridview inside a updatepanel with paging enabled. also i put a modalpopupextender in another updatepanel to do...
0
by: SD | last post by:
Hi, I have to use the ModalPopupExtender prgrammatically.. But the next sample doesn't work: ************************** protected Button bt; protected Button bc; protected Button b; protected...
1
by: =?Utf-8?B?S3lsZSBNLiBCdXJucw==?= | last post by:
I have a set of controls and logic that must be invoked from several pages within a web application as a popup dialog, so I intend to use a userControl contained in a panel extended with the...
0
by: vincent90152900 | last post by:
In a web page,” Default.aspx”, I have two different WebUserControl,” WebUserControl1_1”, and “WebUserControl2_1” and a ModalPopupExtender,” ModalPopupExtender1” and a Button,” Button1” and a Panel,”...
0
by: lax4u | last post by:
I want to use same ModalPopupExtender for two different Link Buttons. The Ajax Control Toolkit team decided to make the TargetControlID of the extender required. That's fine when i have single button...
0
by: mohaaron | last post by:
Hello all, I have been using the ModalPopupExtender as a way of catching errors and displaying them to users. This includes business rule violations that I catch. This all works fine as long as...
2
by: Peter | last post by:
I am trying to use ASP.NET Ajax Control Toolkit ModalPopupExtender which works fine, but what I am trying to do is: 1) User Clicks on the button: 2) Function on the server will check for a...
0
by: uicouic | last post by:
Hi all. I am having trouble getting a ModalPopupExtender to display with the corresponding data. This will be triggered by clicking on a "Details" button in a gridview. Eg. by clicking on Row1...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.