Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 811795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:06:02+00:00 2026-05-15T01:06:02+00:00

I have a delete button in each row of GridView (component ASP.NET). I want

  • 0

I have a delete button in each row of GridView (component ASP.NET). I want some of the delete buttons to be invisible. The visibility of the delete button should depend on the data that are back the row.

GridView is backed by EntityDataSource. GridView displays entities called Category, one instance in each row. Entity Category has (besides others) also a field of type EntityCollection. Name of that field is Items. Basically I want to allow user to delete a row only if the Items field of backing Category entity is an empty collection.

I cannot make up the binding of Visible property. I have no experience with bindings and Google does not really help.
This is how the button looks right now:

<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                    Text="Delete" 
                    Visible=??? ></asp:Button>

I don’t know what should replace ???. The button schold be visible only when this expression evaluates to true:

((SimpleEShop.Model.Category) dataItem).Items.LongCount() <= 0

where dataItem variable contains data of current row in the table.
What is the binding that I need ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:06:03+00:00Added an answer on May 15, 2026 at 1:06 am

    egrunin missed some things try it like this

    Visible='<%# !(((System.Data.Objects.DataClasses.EntityCollection<YourItemType>)Eval("Items")).Count <= 0 )%>'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview control with delete asp:ImageButton for each row of the grid.
I want to have a button in each row to delete the corresponding row.
I have a gridview with edit and delete buttons on each row. I am
I have a listview with each row containing some text and a delete button.
I have a table which each row has some info and a delete button
I have a standard ASP.NET 2.0 web page with a Delete button on it.
I have a search page that loads results. Each row has a Delete button
I have a table which contains delete buttons for each row. I use int
I have a delete button on my web site which I want to add
I have a in-line delete button, I want to append more data to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.