Expression Bind Button Visibility (C #)
I have a delete button on each line GridView
(ASP.NET component). I want some of the delete buttons to be invisible. The visibility of the delete button should depend on the data that is returned in the row.
GridView
supported EntityDataSource
. GridView
displays named objects, Category
one instance on each line. The object Category
has (among others) also a type field EntityCollection
. The name of this field Items
. Basically, I want to allow the user to delete a row only if the Items
lookup field Category
is an empty collection.
I am unable to compose a property binding Visible
. I have no experience with bindings and google doesn't really help. This is what the button looks like right now:
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete"
Visible=??? ></asp:Button>
I don't know what should be replaced ???
. The schold button is visible only when this expression evaluates to true:
((SimpleEShop.Model.Category) dataItem).Items.LongCount() <= 0
where the variable dataItem
contains the data of the current row in the table. What binding do I need?
a source to share