I want to process a field retrieved from the database for a Gridview to check to see if the information in it is a hyperlink. If it is, I want to generate a link from it, otherwise just leave it as raw text. At the moment the field in the Gridview looks like:
<asp:TemplateField HeaderText="Reference">
<EditItemTemplate>
<asp:TextBox ID="txtReference" runat="server" Text='<%# Bind("Reference") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Reference") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
I tried modifying what's in the 'Text' attribute of the ItemTemplate but no matter what I put in I get errors on pageload. How can I dynamically modify what's sent to the browser based on the specific info bound in this field?
Thanks a lot!