Wednesday, March 20, 2013

Grid View column convert in hyperlink field in C# Asp .NET

==>>Some time we need convert Grid View column in hyperlink field So I am posting TWO way using this You can convert Grid View Field in hyperlink fields and Take database field according to field Bind in Grid View:--

1.

 <asp:GridView runat="server" ID="mydridtest"  AutoGenerateColumns="false"
 DataKeyNames="EmpId">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLinkEmp" Text='<%# Bind("EmpName") %>' NavigateUrl='<%# Bind("EmpName", "~/image/{0}") %>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FName" HeaderText="FName" />
<asp:BoundField DataField="Address" HeaderText="Address" />
</Columns>
</asp:GridView>


No comments:

Post a Comment