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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:53:03+00:00 2026-06-13T19:53:03+00:00

how can i get the checkbox state of my checkboxes inside a gridview? i

  • 0

how can i get the checkbox state of my checkboxes inside a gridview?
i have programmatically added them like so,

  foreach (GridViewRow gvr in GridView1.Rows)
  {
     tbCell = new TableCell();
     cbGV = new CheckBox();
     tbCell.Controls.Add(cbGV);
     gvr.Cells.Add(tbCell);
  {

Normally i would get the state of the checkboxes like so(below) when they are inside an itemtemplate, but this is not working, so any ideas guys ??

  foreach (GridViewRow getRowItems in GridView1.Rows)
  {
      chkBox = (CheckBox)(getRowItems.Cells[0].FindControl("cbGV"));

      if(chkBox.Checked == false) 
      {
      chkBox.Checked = true;
      }
  }
  • 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-06-13T19:53:04+00:00Added an answer on June 13, 2026 at 7:53 pm

    Try to add checkbox like this , i.e. as template column and than try to search this will also work rather than adding checkbox dynamically

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"> 
    <Columns> 
    <asp:TemplateField> 
    <ItemTemplate> 
    <asp:CheckBox ID="cbGV" runat="server" /> 
    </ItemTemplate> 
    </asp:TemplateField> 
    </Columns> 
    </asp:GridView> 
    

    this is not working because you forgot to give id to element

    cbGV = new CheckBox();
    cbGV.ID="cbGV";
    tbCell.Controls.Add(cbGV);
    

    try to give id as above and than try to find checkbox in row

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

Sidebar

Related Questions

I have an NSOutlineView with checkboxes. I have the checkbox state bound to a
I can get checkbox state with: var c = Ext.getCmp(my_checkbox).checked; but I can get
How can I get this list of checkboxes to be added to a div
I have checkboxes on my page for which I would like to send their
I have 3 checkboxes where the user can select whatever he wants. I would
I have a Listview that looks like the following: checkbox:textview {0 .. n} I
I have a GridView with a Checkbox on the first column: <asp:GridView ID=dgNumeradores runat=server
This seems like it should be prettty easy - but I just can't get
I have a simple task - to change page link on checkbox state change
I'm playing with small exercise to understand sessions and posts, but can't get them

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.