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

  • Home
  • SEARCH
  • 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 8890721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:34:02+00:00 2026-06-14T22:34:02+00:00

when i checked [checked box] data on my page (1) and then go on

  • 0

when i checked [checked box] data on my page (1) and then go on to next page (2) through paging(bottom button of pages like [1234]) and then checked data on page (2).

when i came back to page (1) then it remain unchecked as i don’t checked anything!!!

all the things remains at its original positions. all are unchecked on both pages .
when coming from 1 page to page 2 (check-boxes of page 1 forget his value and get unchecked) and after when coming from page 2 to page 1 same thing happens.
sorry for my bad and rough English.
any suggestion??

  • 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-14T22:34:03+00:00Added an answer on June 14, 2026 at 10:34 pm

    If its a gridview or any repeater control try this

    Gridview HTML

    <asp:GridView ID="GridView1" runat="server" 
    AutoGenerateColumns="False" AllowPaging="True"  
    PageSize="5" Width="324px" DataKeyNames="CategoryID" 
    OnPageIndexChanging="GridView1_PageIndexChanging">
    <Columns>
    <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" />
    <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" />
    <asp:TemplateField HeaderText="Select">
    <ItemTemplate>
    <asp:CheckBox ID="CheckBox1" runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    

    CS Codes

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
      RememberOldValues();
      GridView1.PageIndex = e.NewPageIndex;
      BindData();
      RePopulateValues();
    }
    

    And

    private void RememberOldValues()
    {
      ArrayList categoryIDList = new ArrayList();
      int index = -1;
      foreach (GridViewRow row in GridView1.Rows)
      {
       index = (int) GridView1.DataKeys[row.RowIndex].Value;
       bool result = ((CheckBox)row.FindControl("CheckBox1")).Checked;
    
      // Check in the Session
      if (Session[CHECKED_ITEMS] != null)
       categoryIDList = (ArrayList)Session[CHECKED_ITEMS];
      if (result)
      {
      if (!categoryIDList.Contains(index))
       categoryIDList.Add(index);
      }
      else
       categoryIDList.Remove(index);
      }
      if (categoryIDList != null && categoryIDList.Count > 0)
       Session[CHECKED_ITEMS] = categoryIDList;
    }
    

    And

    private void RePopulateValues()
    {
      ArrayList categoryIDList = (ArrayList)Session[CHECKED_ITEMS];
      if (categoryIDList != null && categoryIDList.Count > 0)
      {
      foreach (GridViewRow row in GridView1.Rows)
      {
       int index = (int)GridView1.DataKeys[row.RowIndex].Value;
      if (categoryIDList.Contains(index))
      {
       CheckBox myCheckBox = (CheckBox) row.FindControl("CheckBox1");
       myCheckBox.Checked = true;
      }
      }
      }
    }
    

    Bind Data Code

    EDIT

    /* QUERY */
    private const string QUERY_SELECT_ALL_CATEGORIES = "SELECT * FROM Categories";
    
    private void BindData()
    {
      SqlConnection myConnection = new SqlConnection(ConnectionString);
      SqlDataAdapter ad = new SqlDataAdapter(QUERY_SELECT_ALL_CATEGORIES,
      myConnection);
      DataSet ds = new DataSet();
      ad.Fill(ds, "Categories");
      GridView1.DataSource = ds;
      GridView1.DataBind();
    }
    

    For more details chk this Maintaining_State_of_CheckBoxes

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

Sidebar

Related Questions

I have an HTML5 page with several data inputs inside a jQuery Dialog box.
So I have the following: var box = $(.MyCheckBox); if (box[0].checked) { // Do
I have a list box and i am trying to get currently checked item
I checked this link of S.O : Pop Images like Google Images And tried
I checked a load of files in to a branch and merged and then
How to add a check box in a .aspx page. I had used a
I am having slider for a set of data with paging, the problem is
I am creating checked list box with the following template: <Style x:Key=CheckBoxListStyle TargetType={x:Type ListBox}>
I need to seperate the checked and unchecked check box from set of check
Hi I have made checked List Box in WPF but the binding is not

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.