Opening a new window from a HyperLinkField of gridview in asp.net

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p align=left><font face=Arial size=2></font> 
Hii there,
<p align=left> 
<p dir=ltr style="margin-right:0px" align=left>I am using GridView and wants to open a new window from hyperlink field with no toolbars, and not resizable. I also need to pass  the value (may be query string) to the new page. Example code is like:
<p align=left>  <font color="#0000ff" size=2>
<</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>GridView</font><font size=2> </font><font color="#ff0000" size=2>ID</font><font color="#0000ff" size=2>="GridViewPONumber"</font><font size=2>
</font><font color="#ff0000" size=2>Style</font><font color="#0000ff" size=2>="left: 0px; position: absolute; top:0px; border:1" </font><font size=2>
</font><font color="#ff0000" size=2>runat</font><font color="#0000ff" size=2>="server"</font><font size=2> </font><font color="#ff0000" size=2>AutoGenerateColumns</font><font color="#0000ff" size=2>="false"</font><font size=2> </font><font color="#ff0000" size=2>BorderWidth</font><font color="#0000ff" size=2>="2px"</font><font size=2> </font><font color="#ff0000" size=2>CellPadding</font><font color="#0000ff" size=2>="0"</font><font size=2> </font><font color="#ff0000" size=2>CellSpacing</font><font color="#0000ff" size=2>="0"</font><font size=2> </font><font color="#ff0000" size=2>GridLines</font><font color="#0000ff" size=2>="Both"</font><font size=2> </font><font color="#ff0000" size=2>Font-Size</font><font color="#0000ff" size=2>="Small"</font><font size=2> </font><font color="#ff0000" size=2>BackColor</font><font color="#0000ff" size=2>="black"</font><font size=2> </font><font color="#ff0000" size=2>ShowHeader</font><font color="#0000ff" size=2>="false"</font><font size=2> </font><font color="#ff0000" size=2>Width</font><font color="#0000ff" size=2>="98%"</font><font size=2> </font><font color="#ff0000" size=2>DataKeyNames</font><font color="#0000ff" size=2>="PO_NUMBER </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>Columns</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>TemplateField</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>ItemTemplate</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>CheckBox</font><font size=2> </font><font color="#ff0000" size=2>ID</font><font color="#0000ff" size=2>="chkSelect"</font><font size=2> </font><font color="#ff0000" size=2>runat</font><font color="#0000ff" size=2>="server"</font><font size=2> </font><font color="#ff0000" size=2>CssClass</font><font color="#0000ff" size=2>="POS_ChkBox"</font><font size=2> </font><font color="#0000ff" size=2>/></font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>ItemTemplate</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>TemplateField</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font size=2> </font><font color="#ff0000" size=2>DataField</font><font color="#0000ff" size=2>="SNo </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>ItemStyle</font><font size=2> </font><font color="#ff0000" size=2>CssClass</font><font color="#0000ff" size=2>="POS_SNo"</font><font size=2> </font><font color="#0000ff" size=2>/> </font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font size=2> </font><font color="#ff0000" size=2>DataField</font><font color="#0000ff" size=2>="MAT_PROD_ID"</font><font size=2> </font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>ItemStyle</font><font size=2> </font><font color="#ff0000" size=2>CssClass</font><font color="#0000ff" size=2>="POS_MatID"</font><font size=2> </font><font color="#0000ff" size=2>/> </font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font color="#0000ff" size=2>> <font color="#0000ff" size=2>
<</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>HyperLinkField</font><font color="#000000" size=2> </font><font color="#ff0000" size=2>DataTextField</font><font color="#0000ff" size=2>="PO_NUMBER"</font><font color="#000000" size=2> </font><font color="#ff0000" size=2>DataNavigateUrlFormatString</font><font color="#0000ff" size=2>="ShowPODetails.aspx?id={0}"</font><font color="#000000" size=2> </font><font color="#ff0000" size=2>DataNavigateUrlFields</font><font color="#0000ff" size=2>="PO_NUMBER </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>ItemStyle</font><font size=2> </font><font color="#ff0000" size=2>CssClass</font><font color="#0000ff" size=2>="POS_PONum"</font><font size=2> </font><font color="#0000ff" size=2>/> </font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>HyperLinkField</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font size=2> </font><font color="#ff0000" size=2>DataField</font><font color="#0000ff" size=2>="QUANTITY"</font><font size=2> </font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>ItemStyle</font><font size=2> </font><font color="#ff0000" size=2>CssClass</font><font color="#0000ff" size=2>="POS_Quantity"</font><font size=2> </font><font color="#0000ff" size=2>/> </font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font color="#0000ff" size=2>> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font size=2> </font><font color="#ff0000" size=2>DataField</font><font color="#0000ff" size=2>="UOM </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>ItemStyle</font><font size=2> </font><font color="#ff0000" size=2>CssClass</font><font color="#0000ff" size=2>="POS_UOM"</font><font size=2> </font><font color="#0000ff" size=2>/> </font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>BoundField</font><font color="#0000ff" size=2>> <font color="#0000ff" size=2>
</</font><font color="#800000" size=2>Columns</font><font color="#0000ff" size=2>></font><font size=2><font color="#000000 </font>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>RowStyle</font><font size=2> </font><font color="#ff0000" size=2>BackColor</font><font color="#0000ff" size=2>="MistyRose"</font><font size=2> </font><font color="#ff0000" size=2>ForeColor</font><font color="#0000ff" size=2>="Black"/> </font><font size=2>
</font><font color="#0000ff" size=2><</font><font color="#800000" size=2>HeaderStyle</font><font size=2> </font><font color="#ff0000" size=2>BackColor</font><font color="#0000ff" size=2>="MistyRose"</font><font size=2> </font><font color="#ff0000" size=2>ForeColor</font><font color="#0000ff" size=2>="Black"</font><font size=2> </font><font color="#0000ff" size=2>/> </font><font size=2>
</font><font color="#0000ff" size=2></</font><font color="#800000" size=2>asp</font><font color="#0000ff" size=2>:</font><font color="#800000" size=2>GridView</font><font color="#0000ff" size=2>></font><font size=2>
 
<p align=left> 
<p align=left>In above code, I want to navigate to "ShowPODetails.aspx". How to do that??? I am using Master Page</font></font></font>

View the full article
 
Back
Top