Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a gridview and i want to delete a row from it . i want to delete a whole row on account of UID(a primary field in my table). the stored procedure only del the row we click i.e get the value of UID column and passes that to stored proc. my question is how to get the column value. i m using
SQL
obj.UID = Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text);
        obj.Datadelete();

where datadelete() is my method to delete the row but actually it is not working . why? i dont want to use datakeynames prop.
Posted
Comments
Rambo_Raja 26-Jun-13 7:47am    
everything that i am doing is on rowdeleting event of gridview.

obj.UID = Convert.ToInt32(grid_Pump.DataKeys[e.RowIndex]["ID"].ToString());



["ID"] is the column name of db table


before it set DataKeyNames="ID" in gridview


I think it helps u
 
Share this answer
 
v2
Comments
Rambo_Raja 26-Jun-13 7:59am    
great buddy....;)
please select the gridview in ur page and go to the properties... in that u have columns collection go to that option and delete what ever u want to delete... if u wnat to insert some more column then insert their....
 
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