Click here to Skip to main content
12,297,215 members (61,709 online)
Rate this:
 
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 12 Nov 2013
Copyright © CodeProject, 1999-2016
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