Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi,
The code looks like..
.aspx.cs::
--------
if (ddl.SelectedIndex == 10)
           {
               string url="ABC-2118(10-09).pdf";
               Page.ClientScript.RegisterStartupScript(this.GetType(), "open", "OpenWinLIP178("+url+");", true);
           }
.aspx::
-------
var url;
  function OpenWinLIP178(url) {
      window.open(url, 'LIP178', 'height=700,width=850,left=50,center=100,top=50,resizable=yes,scrollbars=yes, toolbars=no, status=no');
  }
 
This code is not working for me.Its throwing the error like 'ABC' is undefined.Can anyone correct this code?
Posted 3-Jan-13 5:11am
Comments
CHill60 at 3-Jan-13 11:16am
   
Do you need to surround ABC-2118(10-09).pdf with quotation marks when passing it into OpenWinLIP178?
priya9826 at 3-Jan-13 11:17am
   
Yeahh..Got the solution.Forget to do that...Thank you very much

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
you can use like this:
 
protected void button_Click(object sender, EventArgs e)
    {
        // open a pop up window at the center of the page.
        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'your_page.aspx', null, 'height=700,width=760,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);
    }
 
Refer the following links too.
open a new window
open a new window using jquery
 
Thanks
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 432
1 sanket saxena 355
2 Abhinav S 258
3 OriginalGriff 235
4 CPallini 205
0 Sergey Alexandrovich Kryukov 8,704
1 OriginalGriff 5,000
2 Peter Leow 3,839
3 Maciej Los 3,535
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid