Method 1. Use the <A> label,
Front-end:
CopyCode The Code is as follows: <a href = '<% # "origimageshow. aspx? Id = 1 & image_id = "+ eval (" ID ") %> 'id =" tb_search "runat =" server "target =" _ blank "> pop-up </a>
<A href = 'javascript: Alert ("<% # origimageshow. aspx? Image_id = "+ eval (" ID ") %>") '> displayed </a>
Use the <A> label and do not refresh the Home Page
Method 2. asp: hyperlink
(1) Foreground: <asp: hyperlink id = "HYPERLINK" runat = "server" text = '<% # eval ("operationflag ") %> 'target = "_ blank"> </ASP: hyperlink>
Backend binding path:Copy codeThe Code is as follows: protected void gridview1_rowdatabound (Object sender, gridviewroweventargs E)
{
If (E. Row. rowtype = datacontrolrowtype. datarow)
{
Hyperlink btnlink = (Hyperlink) E. Row. cells [3]. findcontrol ("HYPERLINK ");
Hiddenfield hidderid = (hiddenfield) E. Row. cells [3]. findcontrol ("log_id"); // obtain the parameter to be passed through the hidden field
String url = string. empty;
If (hidderid! = NULL)
{
Url = "~ /Imagemanage/logpicdetails. aspx? Id = "+ hidderid. value;
Btnlink. navigateurl = URL;
}
}
}
(2) <asp: hyperlink id = "hyperlink1" runat = "server" navigateurl = '<% # "origimageshow. aspx? Image_id = "+ eval (" ID ") %>'
TEXT = "pop-up" target = "_ blank"> </ASP: hyperlink>
When ASP: hyperlink is used, the page does not refresh the homepage.
Method 3.asp: linkbutton
(1) Foreground: <asp: linkbutton id = "tb_searchori" runat = "server" text = "pop-up" onclientclick = <% # "window. Open ('origimageshow. aspx? Image_id = "+ eval (" ID ") +" ') "%> </ASP: linkbutton>
(2) Foreground: <asp: linkbutton id = "tb_searchori" runat = "server" text = "pop-up" onclick = "lb_ori_click" commandargument = '<% # BIND ("ID ") %> '> </ASP: linkbutton> Copy code The Code is as follows: protected void lb_ori_click (Object sender, eventargs E)
{
Linkbutton lbtn = (linkbutton) sender;
Int imgid = int. parse (lbtn. commandargument. tostring ());
String url = "origimageshow. aspx? Image_id = "+ imgid;
Url = page. resolveurl (URL );
Page. clientscript. registerstartupscript (page. getType (), "messid", "<script language = 'javascript '> window. open ('"+ URL +"'); </SCRIPT> ");
}
Use ASP: linkbutton to refresh the homepage after the page is displayed.
To sum up, we recommend Using Hyperlink or.