.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali
Post New Web Links

opening new window from code behind using javascript

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net
 

Hello,

I am trying to open new window when i click on a button using javascript

Page.ClientScript.RegisterStartupScript(this.GetType(), "openwindow", "window.open('WebForm2.aspx','','height=200,width=300');", true);

this is the code i am using.

But the problem is it postsback whole page.

Can some body tell me how i can open new window without posting back the page.

Thanks

Vinod 




View Complete Post


More Related Resource Links

Browser window is opening up on the second click with javascript code

  

Hi,

I am trying to set a javascript code to open up a new browser window with this URL that exists like shown below.

On the first click nothing happens but on the second click the browser window is opening up.

 

How is it possible to make it open up on the first click ?

                                <asp:ImageButton ID="ImageButton3" runat="server" Height="84px" 
                                    ImageUrl="~/images/1.jpg" Width="165px" 
                                    onclick="ImageButton3_Click" />

    protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
    {
        String openURL = "javascript:window.open('" + "Folder1/testing.aspx" + "');return false;";
        ImageButton3.OnClientClick = openURL;
    }


 


call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Simple Captcha Code in Javascript

  
The article Simple Captcha Code in Javascript was added by miya2008 on Tuesday, June 29, 2010.

Here I create a Cptcha Code With JavaScriptStep 1:->In the (.aspx) page we write the following Code:->%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>!DOCTYPE

way of calling "javascript function of parent window from child window."

  
The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

What's the problem in my javascript's code to get ClientID Property?

  

 

 Hi all.

I wirte a simple java script code to get ClientID of controls on the webform. The code is like:

<script type="text/javascript" language="javascript">

var butt = $find("<%= Button1.ClientID %>");

alert(butt);

 <script>

But when i run it , i have a problem. The probmel is:

 

Server Error in '/' Application.

The Controls collection cannot be modified because t

javascript in code behind

  

Hi all,

i want to write javascript for lightbox effect

for that i am usingthe following code but it is giving javascript error.

Response.Write("<Script Language=JavaScript>window.open('frmPreviewQuestionnaire.aspx?qName=" + name + "','Form','location=no,scrollbars=yes,resizable=no,status=no,fullscreen=no,left=250px,top=150px,width=450px,height=300px');</script>");


can anybody help me plz..



Call Server Side Code from Javascript in VB.NET

  

Hi

Could anyone give me an example how to call Server Side Function from javascript and then I want to call that javascript function on Button OnClick () Event.


Thanks in Advance

Shabbir



Closing Javascript Modal dialog window after server side event processing

  

Hello Friends..


Please tell me how to close Javascript ModelDoalog Window.. after Server Side event Processing .

Basically i want close window in  finally Block After sucessfulll Updation.


AMit..... InnocentInnocentInnocentInnocentInnocentInnocentInnocent


What is this Mysterious Javascript code in my asp.net website doing???

  

I have an asp.net website(using Visual studio 2008), when i debug the site on my development machine, it loads well with out any errors. At this point i leave the site running in debug mode but i notice strange things. 


0). When i right click the file and check the properties, it has a URL property whose value is http://cdn1.predictad.com/scripts/publishers/suggestmeyes/predictadme.js?si=7495


1). In my sites Solution Explorer, there appears a folder called "Windows Internet Explorer". Under this folder, there is a file called predictadme.js?si=7495. When i open that file, it contains the code below. (Apologies, i failed to format the code, only saw options for C#, C++, CSS, VB, XML/HTML, Razor, SQL when  trying to insert code and i think the code below is non of these)


I dont have idea where this code is coming from, but the presence of the string .facebook. makes me suspicious. I have a feeling some thing fishy is happening but am really not any where near good at javascript (scripts), so am seeking

Javascript code to copy selected dropdown item to clipboard

  
Does anyone know how I can do this to get the text onto the clipboard?  <input id="Copy" type="button" value="Copy Url" runat="server" onclick="copy();" style="vertical-align: top;" visible="false"/><script type="text/javascript"> function copy() { var sel = document.getElementById("DropDownList1"); var text = sel.options[sel.selectedIndex].value; ??? } </script> </body>  

How to prevent Javascript window to steal focus

  
Hi,I have made an asp.net web application in which i open a javascript window for 4 seconds at regular interval . The problem is that when window opens it steals focus from current application. For example when application is running in background or is minimized and i am typing in word/Excel or outlook, the window pops up and steals the input focus.I want to popup window in some way that it never steal focus from some other application, just like msn or gtalk notification when someone sign in/out.Please suggest how it can be done ? Thanks

Javascript required to get a pop up window from new form.

  
Hello Team, Any help regarding this would be helpful. I have a new form. In that form when i go to the first field...it should open up a pop up window which would have a note in that. How is this possible. I think through javascript this can be possible. So please help me. Thanks in advance.

Can you call a javascript function from code behind?

  
Call you cal a javascript function from the code behind? If so how??? 

I am using the following code to check to see if a panel is visible or not before running javascript

  
Using VB, VS 2010, when I run the following code, I get an error because it executes the code even if I have Panel7 set to invisible.  I am trying to use javascript to see if the panel is visible or not before executing the code.var panelRef7 = document.getElementById('<%= Panel7.ClientID %>'); if (panelRef7) { $find('DragP7').add move(savePanelPosition); }  What am I doing wrong?   Thanks

execute a javascript function in code page

  
I use js function in source page and call that js function as below in Source page<a href="javascript:;" onclick="openwin('Sample.aspx?DID=<%#Eval("UID") %>', '', '700','300','yes'); return false ">I need to call this function from vb.net code page.....how to solve this ........???????????Give ur ideas...............

Closing window in javascript without confirmation

  
Hello! I need to open a browser window without Toolbars, Status bar and Explorer bars (this means no back, refresh, ... buttons, no histiry, no nothing visible in this browser window). This is what I do: from normal browser window I open new window with all the properties I need and than I close the first window: <body>     <script type="text/javascript">  window.open('login.aspx','','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,                        left=0px, top=0px,width=1024, height=768');  window.close();     </script> </body> This would be OK if the first window would just close, but it doesn't. I get the confirmation window with this text: The Web page you are viewing is trying to close the window. Do you want to close this window? I don't want user to have to close the window manually. Can somebody please tell me how to close browser window without the confirmation popup? Thnx in advanced, dvale
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend