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 368723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:51:04+00:00 2026-05-12T13:51:04+00:00

Ok… I have a database table called employees.. This has columns called ID, Name,

  • 0

Ok… I have a database table called employees..

This has columns called ID, Name, datejoined and Cannotbedeleted (check boxes)…

Now i want to add a delete column which deletes the rows when clicked.

But there are some entries which cannot be deleted if the Cannotbedeleted field is true (checked)… so the delete button should be invisible for these rows.

Please tell me a way of how to do this…

            <asp:CheckBoxField DataField="CannotBeDeleted" HeaderText="CannotBeDeleted" 
                SortExpression="CannotBeDeleted" />
            <asp:BoundField DataField="TimeAdded" HeaderText="TimeAdded" 
                SortExpression="TimeAdded" />
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"   
                        CommandName="Delete" Text="Delete" ></asp:LinkButton> 
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>

    </asp:GridView>

I also tried using in delete template field…

‘ >

But i did not know what to do in code behind??
protected bool GetShowDeleteButton()
{

}

The solution is below…. but is there a way i can refresh the page once i click the delete button in the gridview….

  • 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-12T13:51:05+00:00Added an answer on May 12, 2026 at 1:51 pm

    Try looping through the rows in GridView_DataBound, and hide the button for each row that has the checkbox checked.

    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        foreach(GridViewRow myRow in GridView1.Rows)
        {
            //Find the checkbox
            CheckBox ckbox1 = (CheckBox)myRow.FindControl("nameOfCheckBox");
            if(ckbox1.Checked)
            {
                //Find the Delete linkbutton and hide it
                LinkButton deleteButton = (LinkButton)myRow.FindControl("nameOfDeleteLinkButton");
                deleteButton.Visible = false;
            }
        }
    }
    

    Now, here’s the difference you need:

    Implement the CheckBox column as a TemplateField with a CheckBox in it. You can bind the CheckBox to the data from your datasource.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 207k
  • Answers 207k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Both std::vector and ublas::vector are containers. The whole point of… May 12, 2026 at 9:24 pm
  • Editorial Team
    Editorial Team added an answer That does seem strange. I've always found the httplib2 module… May 12, 2026 at 9:24 pm
  • Editorial Team
    Editorial Team added an answer You could just replace the wildcards with a regex equivalent,… May 12, 2026 at 9:24 pm

Related Questions

OK. This is a bit of a vanity app, but I had a situation
OK, I know what you're thinking, "why write a method you do not want
Ok, I asked a question earlier about Flex and ADO.NET Data Services but didn't
OK. This problem is doing my head in. And I don't know if there
OK, this kind of follows on from my previous question . What I would

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.