cyclonebri Posted March 24, 2004 Posted March 24, 2004 Is it possible to change a dynamically generated Datagrid column after generation to become a hyperlink column with the value returned from the dataset displayed, as well as used in the hyperlink? For example, I currently have the datagrid returning and displaying specific information from a table, including the ID number for that data. I want to change the display from just the ID number as text to the ID number as a hyperlink to a new page that has the address like this: newpage.aspx?IDNUM=<the same id number displayed on the grid goes here> I know it is possible to start with a hyperlink column, but since all of that is done and the thing is generated dynamically (no use of drag and drop datasets or dataviews or dataadapters), is there a way to change the property of the column to hyperlink and set it's hyperlink through code? Thanks, Brian Quote
Moderators Robby Posted March 24, 2004 Moderators Posted March 24, 2004 In the ItemTemplate of your grid place something like this... 'aspx file <%# myFunction(DataBinder.Eval(Container.DataItem, "myColumnName")) %> 'code behind file Public Function myFunction(ByVal s As Object) As String If IsDBNull(s) Then Return "" Else Return s & "Something else here" End If End Function Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.