ASP.NET with C# and SQL SERVER , some vb.net . asp.net examples, asp.net codes, asp.net programs, c# code, sql server queries, important codes.
Friday, 19 October 2012
find gridview row on multiple events in asp.net with c#
CheckBox chk1 = (CheckBox)sender;
GridViewRow GridRow1 = (GridViewRow)chk1.NamingContainer;
Response.Write(GridRow1.RowIndex);
--------------------------------------------------------------------------
Button b = (Button)e.CommandSource;
b.CommandArgument = ((GridViewRow)sender).RowIndex.ToString();
----------------------------------------------------------------------------
GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
We can easily find out the row Index Using this code.
string strCureentRowIndex=row.RowIndex;
---------------------------------------------------------------------------
GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent;
GridView gv = (GridView)(e.CommandSource);
string s = gv.DataKeys[row.RowIndex][0].ToString();
-------------------------------------------------------------------------------
int rowNum = -1;
GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);
if (row != null)
{
rowNum = row.RowIndex;
}
--------------------------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment