Wondering how to control the Hyper Link control behavior! Like STYLE, OPEN , SET FOCUS & ATTRIBUTES
Current project requirement to open the Hyper link with specific browser attributes like With Scroll bar, No Menu bar, Specific Window Position, Height & Width.
Achieved with Java Script as shown below code:
string strURL = "http://rajadandu.blogspot.com/";
//Create Hyper Link
HyperLink h = (HyperLink)e.Row.FindControl("ConfHlink");
// Setting Style
h.Style["margin-left"] = "5px";
//Setting default Hyper Link Navigation to NULL
h.NavigateUrl = "javascript:void(null);";
//Hyper Link Display string
h.Text = "Opening With Controlled Hyper Link";
//Java Script with Open Window with attributes
//Then at last Set Focus
h.Attributes["onclick"] = "javascript:window.open('" + strURL + "','','scrollbars=yes,menubar=no,height=430,width=700,top=0,left=0,resizable=yes,toolbar=no,location=no,status=no'); window.focus();";
No comments:
Post a Comment