[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

c#, javascript open a new window

Posted on 2010-08-12
6
Medium Priority
?
449 Views
Last Modified: 2013-12-17
Hi,

I want to open a window with c# code that has something like this

"javascript:window.open('MoreImages.aspx?','','left=250px, top=245px, width=700px, height=450px, scrollbars=no, status=no, resizable=no');return false;"

how can i use this in c# code

Please ehlp

Thanks,

R8VI
0
Comment
Question by:R8VI
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 2000 total points
ID: 33421303
Here is the javascript & c# code

Raj
// Javascript code
function f_open_window_max( aURL, aWinName )
{
   var wOpen;
   var sOptions;

   sOptions = 'status=yes,menubar=no,scrollbars=yes,resizable=no,toolbar=yes';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 200).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=100';

   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}

// C# Code

                Dim strjscript As String = "<script language='javascript'>"
                strjscript += "f_open_window_max('WorkOrder_PrintPreview.aspx?Job_ID=" & CType(intJobId, String) & "');"
                strjscript += "</script" + ">"
                ClientScript.RegisterStartupScript(Me.GetType, "workorder", strjscript)

Open in new window

0
 

Author Comment

by:R8VI
ID: 33421437
hi thanks for this i changed the dimensions in the function javascript but this still is too big how can i change the code to have the dimesions i sent in the question
0
 

Author Comment

by:R8VI
ID: 33421500
also it has to return false
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:R8VI
ID: 33421645
hi, i got it to work how i want but how to i center the new window
0
 
LVL 23

Assisted Solution

by:Rajkumar Gs
Rajkumar Gs earned 2000 total points
ID: 33421724
To load in center screen, try this parameter in that javascript code.
left = NaN,top = NaN

This site may help you, if you want to customize it
http://www.bratta.com/menu_javascripts/pop_up_window/pop_up_window.html

Raj
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 33427975
Please Try This one.
 
Dim strjscript As String = "<script language='javascript'>"
 strjscript += "window.open('MoreImages.aspx?','','left=250px, top=245px, width=700px, height=450px, scrollbars=no, status=no, resizable=no');return false';"
 strjscript += "</script" + ">"
ClientScript.RegisterStartupScript(Me.GetType, "workorder", strjscript)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question