Opening new window from C# code
-
Hi All, I tried to open a new IE window from C# code and it works for any sample website. However, the same code doesnt work for ajax enabled website. I have removed ajax by deleting <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> from .aspx but still it doesnt work, any clues ??? Do i need to remove something more than that ? Here is my code for opening the new window that works on pages other than my website page: string strQS = "http://www.yahoo.com"; StringBuilder strScript = new StringBuilder(); strScript.Append(""); strScript.Append("window.open('" + strQS + "', \"\",\"height=100,width=400,left=0,top=0,toolbar=no,menubar=no\");"); strScript.Append(""); ClientScript.RegisterClientScriptBlock(this.GetType(), "subscribescript", strScript.ToString()); I would appreciate your help. Thanks Knowledge is knowing a tomato is a fruit. Wisdom is not putting it in a fruit salad.
-
Hi All, I tried to open a new IE window from C# code and it works for any sample website. However, the same code doesnt work for ajax enabled website. I have removed ajax by deleting <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> from .aspx but still it doesnt work, any clues ??? Do i need to remove something more than that ? Here is my code for opening the new window that works on pages other than my website page: string strQS = "http://www.yahoo.com"; StringBuilder strScript = new StringBuilder(); strScript.Append(""); strScript.Append("window.open('" + strQS + "', \"\",\"height=100,width=400,left=0,top=0,toolbar=no,menubar=no\");"); strScript.Append(""); ClientScript.RegisterClientScriptBlock(this.GetType(), "subscribescript", strScript.ToString()); I would appreciate your help. Thanks Knowledge is knowing a tomato is a fruit. Wisdom is not putting it in a fruit salad.
First, you can't open a new windOw using C#. you are using C# to inject Javascript that Will open a new window. where are you calling this code? Are you trying to hare this script called when the page is rendered on the client?
only two letters away from being an asset
-
First, you can't open a new windOw using C#. you are using C# to inject Javascript that Will open a new window. where are you calling this code? Are you trying to hare this script called when the page is rendered on the client?
only two letters away from being an asset
This code is called on my grid view event , I want to open a new window on grid event. But on this page where this code is not working, it is not working for any control , be it simple button click , and on other pages, it is working on same events, I wonder whats so special in this page , I thought it must be ajax creating problem but now i have removed its reference from the page with same result happening.
-
This code is called on my grid view event , I want to open a new window on grid event. But on this page where this code is not working, it is not working for any control , be it simple button click , and on other pages, it is working on same events, I wonder whats so special in this page , I thought it must be ajax creating problem but now i have removed its reference from the page with same result happening.
using a script library would be a better approach. are you sure the grid event is being called? check the function name. Is it a typo?
only two letters away from being an asset