Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
C#
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (    e.Row.RowType == DataControlRowType.DataRow)
            {
                
                e.Row.Attributes.Add("onclick", "ChangeRowColor(" + "'" + e.Row.RowIndex + "'" + ")");

            }

        }



im able to select the row index in RowCreated event but not able to select in the SelectedIndexChanged event.... please help

Thanks in advance
Posted
Comments
AshishChaudha 11-Apr-12 1:13am    
try this

GridView1.SelectedRow.RowIndex.ToString();

You cant find Row Index of row in selected index change, but U can find the Row by using .parnt and .namingContainer methods from which you can easily access all the Controls.
I think this will help you!
 
Share this answer
 
try this


C#
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridView1.SelectedRow.RowIndex.ToString();
    }
 
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