c# - How to show button in gridview if a column empty -


in application have 1 editable column , if editable column empty need show add link button displays edit link button.how can display add link button if particular editable column in gridview empty

    <asp:templatefield>     <itemtemplate>          <asp:button visible='<%# string.isnullorempty() %>' runat="server" text="edit" id="edit" commandname="edit" />          <asp:button visible='<%# !string.isnullorempty() %>' runat="server" text="add" id="add" commandname="edit" />     </itemtemplate> </asp:templatefield> 

i tried working unable edit

the easiest way add templatefield gridview 2 buttons have visibility based on column value.

<asp:templatefield>     <itemtemplate>          <asp:button visible='<%# string.isnullorempty(eval("editablefield").tostring()) %>' runat="server" text="edit" id="edit" commandname="edit" />          <asp:button visible='<%# !string.isnullorempty(eval("editablefield").tostring()) %>' runat="server" text="add" id="add" commandname="edit" />     </itemtemplate> </asp:templatefield> 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -