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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:15:22+00:00 2026-05-28T07:15:22+00:00

I have a GridView with a Checkbox on the first column: <asp:GridView ID=dgNumeradores runat=server

  • 0

I have a GridView with a Checkbox on the first column:

<asp:GridView ID="dgNumeradores" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ItemID">
    <Columns>
        <asp:TemplateField HeaderText="Seleccionar">
            <ItemTemplate>
                <asp:CheckBox runat="server" ID="chkChecked" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField HeaderText="Item" DataField="Description">
        </asp:BoundField>
        <asp:BoundField HeaderText="Plantilla" DataField="Template">
        </asp:BoundField>
    </Columns>
</asp:GridView>

Now in the code behind I try to update the Checked column on the DataTable acting as datasource for the GridView (since, as you can see above, the Checkbox column is not bound to the datasource for reasons you probably know.):

Protected Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
    Try
        For Each dr As GridViewRow In Me.dgNumeradores.Rows
            Me.itemsNumTable.Select("ItemID = '" & dgNumeradores.DataKeys(dr.RowIndex).Value & "'")(0)("Checked") = DirectCast(dr.Cells(0).FindControl("chkChecked"), CheckBox).Checked
        Next
        'Some more unimportant-for-this-question code
    Catch ex As Exception
        tableInfo.ShowError(ex.Message)
    End Try
End Sub

The thing is that the Checkbox.Checked always returns False.

How can I get the checked state of the Checkboxes in this scenario? Or what would be the best approach into updating the aforementioned column?

P.S. Note that click on the checkboxes doesn’t post back. Nothing happens on the page until the user clicks Save (and that is the intended behavior).

  • 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-28T07:15:23+00:00Added an answer on May 28, 2026 at 7:15 am

    Are you binding the GridView in Page Load? If that is the case use IsPostBack

    IF Not IsPostBack Then
       DataBind()
    End IF
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Gridview <asp:GridView ID=GridView1 runat=server Width=400px AutoGenerateColumns=false OnSelectedIndexChanged=GridView1_SelectedIndexChanged1> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox
I have this code <asp:GridView ID=gvCentersList runat=server AutoGenerateColumns=False DataKeyNames=CenterID DataSourceID=SqlDataSource1 CssClass=gv-classic> <Columns> <asp:TemplateField HeaderText=>
So - I have a checkbox <asp:CheckBox ID=chkOrder runat=server Visible='<%#IsCheckBoxVisible() %>' Checked=false OnCheckedChanged=chkOrder_CheckedChanged AutoPostBack=true
I have a gridview in which the first column in a checkbox. The grid
Using Asp.net and jQuery I have a GridView with a CheckBox column. Right now
Ok so I have a GridView like this: <asp:GridView ID=gv runat=server ... > ...
I have a GridView in ASP.net where I have a CheckBox column. The user
I have a gridview with the following markup: <asp:GridView ID=gv runat=server Width=700px skinid=gridview HeaderStyle-HorizontalAlign=Left
I have a gridview that I have added a checkbox column using a templatefield
I have an gridview that I am adding onclick events to a checkbox column

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.