|
-
Jan 27th, 2005, 04:50 PM
#1
Thread Starter
Member
UserControl
I have a user control which is linked to the db. It has three buttons: Save, Cancel and Refresh. I wanted to pop up a showmodal window if the user clicks cancel or refresh. I am using C# and javascript. I have added the javascript code for the buttons onclick events. It is not working:
The showmodal call is like this
Code:
window.showModalDialog(webpage,,pagesettings);
can someone tell me what I am doing wrong? Thanks in advance
-
Jan 28th, 2005, 12:18 AM
#2
Re: UserControl
What are the values of webpage and pagesettings? Try hardcoding all the values and then working your way towards vars from there.
-
Jan 28th, 2005, 09:22 AM
#3
Thread Starter
Member
Re: UserControl
webpage is the asp page for the modal window and pagesetting is where the popup window should be and what should be its width, height
-
Jan 28th, 2005, 10:17 AM
#4
Frenzied Member
Re: UserControl
Is that IE only or does Netscape and so on support the DialogBox type window?
Magiaus
If I helped give me some points.
-
Jan 28th, 2005, 11:05 AM
#5
Thread Starter
Member
-
Jan 28th, 2005, 11:09 AM
#6
Thread Starter
Member
Re: UserControl
Let me rephrase the question. Can I call onclick event of a button on a aspx page from the usercontrol. Both usercontrol and button is on the same aspx page. Thanks
-
Jan 28th, 2005, 11:16 AM
#7
Frenzied Member
Re: UserControl
To the best of my knowledge there is no easy way. I had this problem with my cancel button. What I finally did which sucked was to check the URL of the page and take a special action based on the page name. I did things like adding popup to the name of pages that where used in popups and having a special cancel for popups and so on.
The other answer is to expose the event as an event of the user control and attach an event at the page level. This sucks too because well the point of user controls is ready to go drop in elements....
What I do to show a popup from a button is to reg a startup script for the page.
Magiaus
If I helped give me some points.
-
Jan 28th, 2005, 11:34 AM
#8
Thread Starter
Member
Re: UserControl
Can you show me through code of what you mean?
I guess I am finding out is that you can't use document.getElementById in a user control because it has no idea. Thanks again
-
Jan 28th, 2005, 11:41 AM
#9
Frenzied Member
Re: UserControl
The UserControl doesn't have a .ClientID but the controls in the user control do.
This is from a Cancel Button in one of my UserControls. If the Control is in a PopUp it closes the PopUp otherwise it redirects to another page.
PHP Code:
private void Button2_Click(object sender, System.EventArgs e)
{
if(Request.Url.AbsoluteUri.ToLower().IndexOf("popup") != -1)
{
Page.RegisterStartupScript("-closeMe" + this.UniqueID,"<script language=\"JavaScript\"><!--\r\nwindow.close();\r\n\\\\--></script>");
}
else
{
this.ViewState.Clear();
Response.Redirect(this.Page.Request.Url.AbsolutePath, true);
}
}
In this case I redirect back to the root page because I load My controls on the fly unless they are in a Popup. The default control for most of my pages is a UserControl with a DataGrid used to view the info.
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|