Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Add 1 new row for each row in girdview and then update all the records, but it JUST Update 1 / 2 records of Girdview ? Any body Help me ?

This is my code:


//Add new row for or each row in girdview
// C#
       protected void gvUsersL_RowDataBound(object sender, GridViewRowEventArgs e)
       {
           if (e.Row.RowType == DataControlRowType.DataRow)
           {

               GridViewRow g = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
               //creating table Cells
               TableCell tCell = new TableCell();
               tCell.Text = table;
               //Add Cells
               g.Cells.Add(tCell);
               tCell.ColumnSpan = e.Row.Cells.Count;
               //Set Color for Empty Cell
               g.CssClass = "bgi_1";
               Table tbl = e.Row.Parent as Table;
               //add rows
               tbl.Rows.Add(g);
           }
        }



//Then Update:

for (int i = 0; i < gvUsersL.Rows.Count; i++)
{
//update here 
}


Any body Help me ? Thanks.
Posted
Updated 23-Jun-11 4:55am
v4
Comments
Karthik. A 23-Jun-11 10:56am    
Added pre tags for code blocks
[no name] 24-Jun-11 1:07am    
Can you please explain little more on the code part? Because I cannot get the complete idea about the requirement.

please check the grid bind code is it in (!isPostback ) block if not then do it
This might solve your problem

Thanks
Faisal
 
Share this answer
 
Please see explain little more with this image:

http://imageshack.us/f/8/628201142646am.png/

Thanks,
 
Share this answer
 

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