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

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Window.open javascript is not working on linkbutton click even

Posted By: Deep Gautam     Posted Date: February 28, 2011    Points:2   Category :ASP.Net
Dear all,
I have one link button .
Onthe click of link button i am writing this line of code to open
the window with some query string but its not opening please let me know soltuion ASAP.

mlnkChapTest.Attributes.Add("onclick", "window.open('TestManagement.aspx?Mod=" + mddlCourse.SelectedItem.Text + "&&Mc=" + mddlCourse.SelectedItem.Value + "&Chap=" + mddlChapter.SelectedItem.Text + "&CC=" + mddlChapter.SelectedItem.Value + ", 'newwindow','toolbar=yes,location=no,menubar=no,width=600,height=600,resizable=yes,scrollbars=yes,top=200,left=250');return false;");

Thanks In Advance....

Deep Gautam
Happy Coding

Author: Maverick             
Posted Date: February 28, 2011     Points: 20   

First check that u not blocked the popups from ur browser...

Or use this code it may help
Write this on click event of the button.

String popupScript;

popupScript = "<script language='javascript' type='text/javascript'>" + "window.open(YourPage.aspx?id=" + ViewState_MID + "&fid=" + ViewState_FID + "&eid=" + strEID + "&qid=" + QueryString_QID + "&mid=" + QueryString_MID + "','_Compile','titlebar=no,toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, height=400px, width= 600px, copyhistory=yes')" + "</script>";

ScriptManager.RegisterStartupScript(this, this.GetType(), "PopupScript", popupScript, false);

Hope this helps. ..:)


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

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