Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I need to fetch the row index of a asp.net grid and pass that rowindex into a method. But i am not able to fetch the row index of the grid on the CheckedChanged event of a checkbox in datagrid. :( .

Please help me.

Thanks

Varun Sareen
Posted
Comments
Shahriar Iqbal Chowdhury/Galib 14-Feb-11 3:59am    
use data key.you will not get rowindex on CheckedChanged event
Varun Sareen 14-Feb-11 4:07am    
kindly elaborate

Simply,

you can write checkbox in template field of gridview.
then give command name to your checkbox field.
then you can use rowcommand event of gridview and in that
u can use row.rowindex property under your given command name :omg:
 
Share this answer
 
I think you could work backwards from the CheckBox you get as object sender in the event handler parameters, find the GridViewRow and get the index from there. by navigating up the .Parent property of the CheckBox and any containing controls you will get to the GridViewRow.
 
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