?
Solved

c#, javascript open a new window

Posted on 2010-08-12
6
Medium Priority
?
451 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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

850 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