Jeff Fillegar
asked on
asp.net - gridview dynamic hyperlink item templates
Hello Experts,
c#, asp.net, dynamic data web application:
I have a gridview that displays a hyperlink for the FILENAME column. The text displayed to the user is "VIEW FILE". When the user clicks on it a new browser is displayed with the contents of that file. Here is the gridview code:
What I would like to do is not display the text "VIEW FILE" if that column does not have a file (empty string or null). Any ideas?
c#, asp.net, dynamic data web application:
I have a gridview that displays a hyperlink for the FILENAME column. The text displayed to the user is "VIEW FILE". When the user clicks on it a new browser is displayed with the contents of that file. Here is the gridview code:
<asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
AllowPaging="True" AllowSorting="True" CssClass="DDGridView"
RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6"
AutoGenerateColumns="false">
<Columns>
<asp:DynamicField DataField="SCENARIO" />
<asp:DynamicField DataField="SERVER" />
<asp:DynamicField DataField="RESULT" />
<asp:TemplateField HeaderText="FILENAME">
<ItemTemplate>
<asp:HyperLink runat="server" ID="FILENAME" NavigateUrl='<%# Eval("FILENAME") %>' Target="_blank" >VIEW FILE</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:DynamicHyperLink runat="server" Action="Edit" Text="Edit"
/> <asp:LinkButton runat="server" CommandName="Delete" Text="Delete"
OnClientClick='return confirm("Are you sure you want to delete this item?");'
/> <asp:DynamicHyperLink runat="server" Text="Details" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
What I would like to do is not display the text "VIEW FILE" if that column does not have a file (empty string or null). Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER