且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根据同一行中单元格的值显示和隐藏gridview按钮

更新时间:2023-02-05 15:03:57

结果与预期相反,因为if条件错误。

只需在条件中添加而不是,它应该按预期工作。

The result is opposite than the expected because the if condition is wrong.
Just add a not to the condition and it should work as expected.
if (!String.IsNullOrEmpty(myDataRowView["Signout_Time"].ToString()))
{
  //rest of code





如果不是,请告诉我。有帮助:)



Please let me know, if it doesn't helps :)


我发现了另一种更简单的方法emTemplae。这就是我做的事情



I have discovered another easier way of doing it in my ItemTemplae. this is what i did

<pre lang="ASP.NET"><asp:Button Visible='<%# string.IsNullOrEmpty(Eval("Signout_Time").ToString()) %>' runat="server" Text="Sign out" ID="out"  CommandName="SignOut" CommandArgument='<%#Eval("SN") %>'/>







这也是神奇的。两种解决方案都很完美




This also did the magic. Both solutions are perfect