Hello all
I am working on creating a Web application
I am using C# code behind
..NET1.1
Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.
I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.
Thanks everyone
Jeff 8 4846
You need to use javascript to open a new window. ASP.Net is server side.
You can do something like this on the page to place javascript to execute on
load or you could add an onlick event to the button control with the
javascript popup code
Page.RegisterStartupScript("PopMsg", "<script language=javascript>alert('" +
PopMessage + "');</script>")
"Jeff User" <je*******@hotmail.com> wrote in message
news:t7********************************@4ax.com... Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
Yes, it is common issue, if you have ever done some client-side script.
Server-side code cannot, or is not allowed to, open new browser window.
Typically, you can emit client script code in your ASP.NET code. Here is an
simple example:
private void Page_Load(....)
{
if (!Page.IsPostBack)
{
//Some code...your querystring value may have to be generated
dynamically
string queryString1=SomeProcess1();
string queryString2=SomeProcess2();
Button1.Attributes.Add("onclick","OpenNewWindow('A notherPage.aspx?aaa="
+ queryString1 + "&bbb=" + queryString2 + "');");
}
}
Then, on the page's HTML view, add this javaScript function into
<Head></Head>section
function OpenNewWindow(target)
{
var
win=window.open(target,"TheNewWindow","height=500, width=500,menubar=0");
win.focus();
}
"Jeff User" <je*******@hotmail.com> wrote in message
news:t7********************************@4ax.com... Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
Thanks
This is very close.
I got the script to work, but now, instead of adding the onClick
attribute to a button, instead of that line, can I somehow add those
settings to the Client side "onload" event?
This way I can control when it happens from within my C# code.
I tried typing Page.
but intellisense does not show me an "Attributes" to add to for the
page. I know I could put this in the <body onload="function"> but then
it would load all the time. thats not good.
Thanks again.
Jeff
On Tue, 27 Jun 2006 13:55:02 -0700, "Norman Yuan"
<No*****@NotReal.not> wrote: Yes, it is common issue, if you have ever done some client-side script. Server-side code cannot, or is not allowed to, open new browser window.
Typically, you can emit client script code in your ASP.NET code. Here is an simple example:
private void Page_Load(....) { if (!Page.IsPostBack) { //Some code...your querystring value may have to be generated dynamically
string queryString1=SomeProcess1(); string queryString2=SomeProcess2();
Button1.Attributes.Add("onclick","OpenNewWindow('A notherPage.aspx?aaa=" + queryString1 + "&bbb=" + queryString2 + "');"); } }
Then, on the page's HTML view, add this javaScript function into <Head></Head>section
function OpenNewWindow(target) { var win=window.open(target,"TheNewWindow","height=500 ,width=500,menubar=0"); win.focus(); }
"Jeff User" <je*******@hotmail.com> wrote in message news:t7********************************@4ax.com.. . Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
Make the body tag a server tag:
<body id="Body" runat="server">
Declare the reference to the tag in code behind:
protected HtmlGenericControl Body;
Now you can use the Attributes property to add onload to the tag.
Jeff User wrote: Thanks This is very close. I got the script to work, but now, instead of adding the onClick attribute to a button, instead of that line, can I somehow add those settings to the Client side "onload" event?
This way I can control when it happens from within my C# code.
I tried typing Page. but intellisense does not show me an "Attributes" to add to for the page. I know I could put this in the <body onload="function"> but then it would load all the time. thats not good.
Thanks again. Jeff
On Tue, 27 Jun 2006 13:55:02 -0700, "Norman Yuan" <No*****@NotReal.not> wrote:
Yes, it is common issue, if you have ever done some client-side script. Server-side code cannot, or is not allowed to, open new browser window.
Typically, you can emit client script code in your ASP.NET code. Here is an simple example:
private void Page_Load(....) { if (!Page.IsPostBack) { //Some code...your querystring value may have to be generated dynamically
string queryString1=SomeProcess1(); string queryString2=SomeProcess2();
Button1.Attributes.Add("onclick","OpenNewWindow('A notherPage.aspx?aaa=" + queryString1 + "&bbb=" + queryString2 + "');"); } }
Then, on the page's HTML view, add this javaScript function into <Head></Head>section
function OpenNewWindow(target) { var win=window.open(target,"TheNewWindow","height=500, width=500,menubar=0"); win.focus(); }
"Jeff User" <je*******@hotmail.com> wrote in message news:t7********************************@4ax.com... Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
Jeff,
Yes this was common practise, be aware that there are a lot of popup killers
now going around which prevent that there is an extra window opened from
javascript.
You can as well create a little panel on your normal page that looks like a
popup and ask the user to enter information. (What is very much easier to do
in ASPNET).
Cor
"Jeff User" <je*******@hotmail.com> schreef in bericht
news:t7********************************@4ax.com... Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
Do you have an eample of the panel method? I might like to try that.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl... Jeff,
Yes this was common practise, be aware that there are a lot of popup killers now going around which prevent that there is an extra window opened from javascript.
You can as well create a little panel on your normal page that looks like a popup and ask the user to enter information. (What is very much easier to do in ASPNET).
Cor
"Jeff User" <je*******@hotmail.com> schreef in bericht news:t7********************************@4ax.com... Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
Jon,
Therefore is not so much sample needed, drag a panel on your form and start
to put other controls on that. Than you can make it visible and hide it any
time you want in your code.
By instance panel1.visible = false 'or true
Cor
"Jon" <ru******@msn.com> schreef in bericht
news:ea*************@TK2MSFTNGP02.phx.gbl... Do you have an eample of the panel method? I might like to try that.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:%2****************@TK2MSFTNGP04.phx.gbl... Jeff,
Yes this was common practise, be aware that there are a lot of popup killers now going around which prevent that there is an extra window opened from javascript.
You can as well create a little panel on your normal page that looks like a popup and ask the user to enter information. (What is very much easier to do in ASPNET).
Cor
"Jeff User" <je*******@hotmail.com> schreef in bericht news:t7********************************@4ax.com... Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
ok, I've done that before. I thought maybe this was something different.
Thanks
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl... Jon,
Therefore is not so much sample needed, drag a panel on your form and start to put other controls on that. Than you can make it visible and hide it any time you want in your code.
By instance panel1.visible = false 'or true
Cor
"Jon" <ru******@msn.com> schreef in bericht news:ea*************@TK2MSFTNGP02.phx.gbl... Do you have an eample of the panel method? I might like to try that.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:%2****************@TK2MSFTNGP04.phx.gbl... Jeff,
Yes this was common practise, be aware that there are a lot of popup killers now going around which prevent that there is an extra window opened from javascript.
You can as well create a little panel on your normal page that looks like a popup and ask the user to enter information. (What is very much easier to do in ASPNET).
Cor
"Jeff User" <je*******@hotmail.com> schreef in bericht news:t7********************************@4ax.com... Hello all I am working on creating a Web application I am using C# code behind .NET1.1
Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a button. Addionally, I want to send a (query ?) string to the window to be displayed. This will be used to display additional information for the user to see while still on the same page.
I thought this would be a common issue, but I do not see any discussion of it that provides any answers or code.
Thanks everyone
Jeff
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
2 posts
views
Thread by venkatesh |
last post: by
|
4 posts
views
Thread by Phillip Parr |
last post: by
|
4 posts
views
Thread by Dan Cruz |
last post: by
|
23 posts
views
Thread by Markus |
last post: by
|
13 posts
views
Thread by ldan |
last post: by
|
reply
views
Thread by Steve |
last post: by
|
1 post
views
Thread by Nevyn Twyll |
last post: by
|
7 posts
views
Thread by anthony.turcotte |
last post: by
| | | | | | | | | | |