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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:26:21+00:00 2026-06-16T12:26:21+00:00

i have a grid as <Columns> <asp:TemplateField HeaderStyle-Width=20px> <ItemTemplate> <asp:CheckBox ID=ChkSelect runat=server /> </ItemTemplate>

  • 0

i have a grid as

 <Columns>
            <asp:TemplateField HeaderStyle-Width="20px">
                <ItemTemplate>
                    <asp:CheckBox ID="ChkSelect" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Id" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="LbLId" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="LblId" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                </EditItemTemplate>
                <ItemStyle HorizontalAlign="Center" Width="20%" />
            </asp:TemplateField>

i want to retrieve the ID of a Checkbox which is checked. I have tried implementing this code, as

 foreach (GridViewRow row in GvDDlToken.Rows)
            {
                CheckBox chk = row.Cells[0].Controls[0] as CheckBox;
                if (chk != null && chk.Checked)
                {

                        string id = "," + row.Cells[1].Text;


                }
            } 

but at Checkbox chk the value comes as null, no object reference has been made. what possible error i am doing? Thanks for any assistance.

  • 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-16T12:26:22+00:00Added an answer on June 16, 2026 at 12:26 pm

    you should use FindControl

    sample :

    foreach (GridViewRow row in GvDDlToken.Rows)
    {
        if(((CheckBox)row.FindControl("CheckBox1")).Checked == true)
        {
        //some code
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nested gridview: <gridview id=gvParent runat=server > <Columns> <asp:TemplateField> <ItemTemplate> <asp:Label Id=name
I have GridView: <asp:GridView ID=MyGridView runat=server ShowFooter=true AutoGenerateColumns=False Visible=True> <Columns> <asp:BoundField DataField=id ItemStyle-HorizontalAlign=center/> <asp:BoundField
I have a grid view as under <asp:GridView ID=dgTask runat=server Width=100% AutoGenerateColumns=False onrowdatabound=dgTask_RowDataBound> <Columns>
I have a Datagrid which looks as under <asp:GridView ID=dgTask runat=server Width=100% AutoGenerateColumns=False> <Columns>
So I have an ASP.NET grid view: <asp:GridView ID=gvReferences runat=server AutoGenerateColumns=False ShowHeader=False OnRowEditing=gvReferences_RowEditing OnRowDeleting=gvReferences_RowDeleting
Here's the GridView: <asp:GridView ID=MyGridView runat=server AllowPaging=true AllowSorting=true OnPageIndexChanging=MyGridView_PageIndexChanging OnSorting=MyGridView_Sorting> <Columns> <asp:TemplateField HeaderText=ID SortExpression=Id>
I have defined a nested grid view in the following way. <asp:GridView ID=GridView1 runat=server
I have an asp:GridView declared as follows: <asp:GridView runat=server id=dg_myprojects AllowSorting=true AutoGenerateColumns=false Width=900px CssClass=Grid
I have this scenario. An ascx contains this GridView: <asp:GridView ID=dataTable runat=server > <Columns>
I have asp grid view and i created 4 columns(Id,Name,quantity,price) and a footer. i

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.