Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.5
Hello Friends
 
I have a query related grid view in asp.net. My query is that I want to get selected row index on check box click of grid view in asp.net. I want to use this selected row index in my code.
 
Please Provide me the solution for this.
Posted 19-Sep-11 18:12pm
Edited 19-Sep-11 18:58pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

use link button or any button but you have to pass command argument like written below
 
<asp:linkbutton id="LinkButton1" runat="server" causesvalidation="False" commandname="Edit" commandargument="<%# Container.DataItemIndex %>" xmlns:asp="#unknown"> </asp:linkbutton> 
after that you can get Rowindex from code behind like this
int RowIndex = Convert.ToInt32(e.CommandArgument.ToString());
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

if you are in row databound event you can get like this
 

e.Row.RowIndex
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 349
1 Nirav Prabtani 268
2 _Amy 185
3 CHill60 170
4 Richard Deeming 135
0 OriginalGriff 8,004
1 Sergey Alexandrovich Kryukov 7,017
2 Maciej Los 4,039
3 Peter Leow 3,738
4 CHill60 2,912


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 12 Nov 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100