19 Aug 2011

Calling function from gridview template field

<asp:TemplateField HeaderText="Display">
    <ItemTemplate>
        <asp:Image ID="Image2" runat="server" ImageUrl='<%# imageUrl(Eval("Display")) %>' />
    </ItemTemplate>
</asp:TemplateField>

Public Function imageUrl(ByVal Display As String) As String
    If Display = "Y" Then
        Return "~/App_Themes/images/yesstatus.gif"
    Else
        Return "~/App_Themes/images/nostatus.gif"
    End If
    Return ""
End Function

No comments:

Post a Comment