Click here to Skip to main content
15,917,481 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using datatable(View State) as datasource to bind Gridview but how to update datatable to datasource.
C#
protected void GridView3_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {

            GridViewRow row = (GridViewRow)GridView3.Rows[e.RowIndex];
            DataTable tableupd = ViewState["CurrentTable"] as DataTable;
            
          //How to Update datatable here.....

            GridView3.DataSource = tableupd;
            GridView3.DataBind();
        
        }
Posted
Updated 12-May-14 20:16pm
v2

1 solution

C#
foreach(DataRow dr in table.Rows) // search whole table
    {
        if(dr["Product_id"] == 2) // if id==2
        {
            dr["Product_name"] = "cde"; //change the name
            //break; break or not depending on you
        }
    }
 
Share this answer
 
v2

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