Link to home
Start Free TrialLog in
Avatar of KavyaVS
KavyaVS

asked on

Page.ClientScript.RegisterStartupScript is not working

Hi,
I am trying to open a window and passing the parameters in button click event in .Net 3.5 application,VS 2010.
I added this code in button_click event:

Page.ClientScript.RegisterStartupScript(this.GetType(), "Pop up", "<script language='javascript'>" + "window.open('/Forms/AddNewInfo.aspx?param1=" + txtbx1.Text.Trim() + "&param2=" + txtbx2.Text.Trim() + "',null,'height=1000, width=1000,status= no,resizable= yes, scrollbars=yes, toolbar=no,location=no,menubar=no ');</script>");

Any suggestions please.

Thanks
SOLUTION
Avatar of Craig Wagner
Craig Wagner
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi KavyaVS

i've tried your code its working fine here.
may be there would be a path problem within the script just try this way

Page.ClientScript.RegisterStartupScript(this.GetType(), "Pop up", "<script language='javascript'>" + "window.open('~/Forms/AddNewInfo.aspx?param1=" + txtbx1.Text.Trim() + "&param2=" + txtbx2.Text.Trim() + "',null,'height=1000, width=1000,status= no,resizable= yes, scrollbars=yes, toolbar=no,location=no,menubar=no ');</script>");

as your code is working as expected.

hope this helps.
Avatar of KavyaVS
KavyaVS

ASKER

I tried this after changing the path.But still the page is not opening up in new window.
I am using Ajax toolkit and update panel in the page.
Is anything prevent opening the page?

Page.ClientScript.RegisterStartupScript(this.GetType(), "Pop up", "<script language='javascript'>" + "window.open('~/Forms/AddNewInfo.aspx?param1=" + txtbx1.Text.Trim() + "&param2=" + txtbx2.Text.Trim() + "',null,'height=1000, width=1000,status= no,resizable= yes, scrollbars=yes, toolbar=no,location=no,menubar=no ');</script>");

Thanks
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KavyaVS

ASKER

Hi patil786,
I checked my browser. JavaScript is not disabled.
Please find the attached  .aspx code and code behind files.
Please let me know if I need to make any changes.

Thanks
Default2-062913.txt
Default-code.txt
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KavyaVS

ASKER

I checked and closed all the tags and changed the aspx page.
Please see the attached aspx page. It's still not opening the page in new window.

Thanks
Default2-070313.txt
Avatar of KavyaVS

ASKER

Thanks