Hyperlink column in a datagrid

  • Thread starter Thread starter Ravikanth[MVP]
  • Start date Start date
R

Ravikanth[MVP]

Hi

asp:DataGrid id="YourID" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="Sample Column">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%
#Container.DataItem("TextVal")%>' NavigateUrl='<%
# "page.aspx?Param1=" & Server.UrlEncode
(Container.DataItem("Val1")) & "&Param2=" &
Server.UrlEncode(Container.DataItem("Val2"))'%>/>
</ItemTemplate>
</asp:TemplateColumn>

</Columns>



Ravikanth[MVP]
 
Thanks. But I want the AutoGenerateColumns=TRUE, and then
create a hyperlink column from a dataset. I don't want to
hardcode the column name. Is is not possible to get it
work this way?
 
Back
Top