Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My code as follows

C#
protected void Page_Load(object sender, EventArgs e)
        {
           if (!IsPostBack)
                {
                     BindData();
                }
       }

 protected void BindData()
        {
             String strConnString = ConfigurationManager.ConnectionStrings["ConnectionStrings"].ConnectionString;
                SqlConnection con = new SqlConnection(strConnString);
                SqlCommand cmd = new SqlCommand("select * from [transact].[transaction_item] where status = 'new'", con);
                con.Open();
                SqlDataAdapter da = new SqlDataAdapter();
                DataSet ds = new DataSet();
                da.SelectCommand = cmd;
                da.Fill(ds);
                grdRpt.DataSource = ds;
                grdRpt.DataBind();
        }


 protected void grdRpt_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            grdRpt.PageIndex = e.NewPageIndex;
            BindData();
        }

 protected void btnsubmit_Click(object sender, EventArgs e)
        {
            
        }

when i run the above code output as follows


selectdata  transactid  transactitemtype transactorgin   status
     
     Checkbox      1          123              IVC            New
     Checkbox      2          245              IVC            New
     Checkbox      3          345              IVC            New
     Checkbox      4          645              IVC            New
     Checkbox      5          723              IVC            New
     Checkbox      6          445              IVC            New
     Checkbox      7          545              IVC            New
     Checkbox      8          923              IVC            New
     Checkbox      9          245              IVC            New
     Checkbox      10         845              IVC            New

    1  2

1 and 2 paging will be there in the gridview

What I have tried:

in first page five records will displayed and in the second page another five records will displayed.

suppose in the first page i check two rows and in the second page i check two rows means that selected check box rows to update in the [transact].[transaction_item] in the table.

for that how to do using c#.
Posted
Updated 13-Jun-18 20:14pm
v2
Comments
[no name] 14-Jun-18 10:02am    
You need to show what you codetried for this and what issue you are facing.

If you need logic it should be like -

When you select the checkboxes you have checked value to true. Read data from dataset/table bind to this grid control and pick only columns where checkbox column is set to True and use only these records to update in your desired table. The record set to False you need to skip.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900