You can bind the
Visible
property in the markup, without using the
RowDataBound
event:
<asp:Button ID="btnShare" runat="server"
Visible='<%# String.IsNullOrWhiteSpace(Eval("SharePass", "{0}")) %>'
...
/>
(Using IsNullOrWhiteSpace
will handle cases where the value is a string that only contains whitespace characters. This would look empty in HTML, but would not pass IsNullOrEmpty
, and would not be equal to an empty string.)