Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to update a data in grid

here it is my code but it's gettin error

C#
protected void gvclass_RowUpdating1(object sender, GridViewUpdateEventArgs e)
        {
            classinfo infoclass = new classinfo();
            classsp spclass = new classsp();
            GridViewRow row = gvclass.Rows[e.RowIndex];
            infoclass.classId = decimal.Parse(gvclass.DataKeys[e.RowIndex].Value.ToString());
            infoclass.className = ((TextBox)row.FindControl("txtICLassName")).Text;
            infoclass.noOfSeats = int.Parse(((TextBox)row.FindControl("txtISeats")).Text);
            int a = spclass.ClassEdit(infoclass);
            gvclass.EditIndex = -1;
            gridfill();          
        }
Posted
Updated 24-Aug-13 2:20am
v2
Comments
[no name] 24-Aug-13 6:52am    
And the error is what? Or do you expect people to guess?
SaqibRasheed 24-Aug-13 15:09pm    
The information you have provided is not enough; provide more details especially about the error you are getting.
giri001 24-Aug-13 15:26pm    
if we do proper debugging of our code then it will help us to learn.(*suggestion).

1 solution

write like below
infoclass.className = ((TextBox)gvclass.rows[e.rowindex].FindControl("txtICLassName")).Text;
may be helpful.
 
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