473,320 Members | 1,612 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,320 software developers and data experts.

Problem with RegisterStartupScript in c#

Hi,

I tried calling a RegisterStartupScript from c#, my code looks as bellow

string strRpt = "<script language='JavaScript'> \r " +
"function OpenReports() { \r " +
"window.open('http://localhost/webapplication1_vintest/webform5.aspx','','dialogHeight: 515px; dialogWidth: 630px;edge: Sunken;directories=no;center: Yes;help: no;scrollbars=no; resizable: No; status: no;toolbar=no;menubar=no;location=no; modal=yes;titlebar=no;'); \r" +
"} \r" +
"</script>";


if(!this.IsStartupScriptRegistered("OpenScript"))
{
this.RegisterStartupScript("OpenScript", strRpt);
}


when I tried to execute the new window is not getting opened.
Can anyone suggest me, what went wong??
Jul 4 '07 #1
4 2118
dip_developer
648 Expert 512MB
Hi,

I tried calling a RegisterStartupScript from c#, my code looks as bellow

string strRpt = "<script language='JavaScript'> \r " +
"function OpenReports() { \r " +
"window.open('http://localhost/webapplication1_vintest/webform5.aspx','','dialogHeight: 515px; dialogWidth: 630px;edge: Sunken;directories=no;center: Yes;help: no;scrollbars=no; resizable: No; status: no;toolbar=no;menubar=no;location=no; modal=yes;titlebar=no;'); \r" +
"} \r" +
"</script>";


if(!this.IsStartupScriptRegistered("OpenScript"))
{
this.RegisterStartupScript("OpenScript", strRpt);
}


when I tried to execute the new window is not getting opened.
Can anyone suggest me, what went wong??
have you assigned the function to any server control's event??
like
<input type="button" value="ClickMe" onclick="[color=maroon][color=#000000]OpenReports()"[/color][/color]>
..............when the block is being executed...???
Jul 4 '07 #2
have you assigned the function to any server control's event??
like
<input type="button" value="ClickMe" onclick="[color=maroon][color=#000000]OpenReports()"[/color][/color]>
..............when the block is being executed...???

No, I have not included to any events...
Jul 4 '07 #3
dip_developer
648 Expert 512MB
No, I have not included to any events...
when do u want to open the pop-up window??? if any button control's click event then assign your function name to that control event......like i said
Jul 4 '07 #4
when do u want to open the pop-up window??? if any button control's click event then assign your function name to that control event......like i said

I mean to say that, I have not called that function in any client side events. As u said I tried calling in server side events on page load.
In the mean time, I have fixed that. Instead of Calling that as a java function I tried calling as the script bellow. In that I have excluded the function <name> & {}


string strRpt = "<script language='JavaScript'> \r " +
"window.open('http://localhost/webapplication1_vintest/webform5.aspx','','dialogHeight: 515px; dialogWidth: 630px;edge: Sunken;directories=no;center: Yes;help: no;scrollbars=no; resizable: No; status: no;toolbar=no;menubar=no;location=no; modal=yes;titlebar=no;'); \r" +
"</script>";


if(!this.IsStartupScriptRegistered("OpenScript"))
{
this.RegisterStartupScript("OpenScript", strRpt);
}

I could't understand, what difference its making??
Jul 4 '07 #5

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

Similar topics

0
by: Leslie McGann | last post by:
Hi, I need to open a different pdf file in an iframe each time the user clicks a button. I also need to open the pdf to a specific page each time. The pdfs in question are located on a web...
2
by: Marc Castrechini | last post by:
With SmartNavigation=true a call to display a simple javascript alert returns in IE showing an "Invalid Pointer" error. Apparently when SmartNavigation is disabled then the alert works correctly....
0
by: rom | last post by:
my main aspx page has 3 user controls. they are all located in the same place of the page and each time i set the visibility of 2 of them to false and 1 to true. now, i want to use the...
7
by: sck10 | last post by:
Hello, I have the following sub in a class in my "App_Code" directory. The script is for setting focus on a particular control, but I get the error, "Name ClientScript Not declared". Also, I am...
2
by: gnewsham | last post by:
I am converting an application from vb.net 2003 to 2005 I have the following function which I call when an input error is detected: Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control) Dim...
3
by: MJP | last post by:
I have a button which kicks off the generation of a report after which the file will be downloaded. The report generation can take a long time, so client side onclick event of the button also...
1
by: HockeyFan | last post by:
My function to get an alert box on the page isn't working. Instead it puts in the bottom section of the page: <script type="text/javascript"> <!-- This is a test// --> </script> The...
3
by: Rob | last post by:
Hi, We've developed an ajax enabled web app which we're currently deploying to our production server. We use System.Web.UI.Page.RegisterStartupScript throughout the app, and all has worked well...
4
by: =?Utf-8?B?RHVuZTg4?= | last post by:
I've got some code that uses Page.ClientScript.RegisterStartupScript to call a javascript function from the Page_Load method in the code behind. The code works fine in IE but the javascript...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.