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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top