Monday, May 24, 2010

Row Index on button click in a gridview

Find the Row index when you click a button in a gridview by using the following in the button click method in code behind

GridViewRow row = ((LinkButton)sender).Parent.Parent as GridViewRow;
Response.Write(row.RowIndex);


Other way to use it is to have a command Name(for ex:View) and a Command Argument for the button and then using the GridView_RowCommand(object sender, GridViewCommandEventArgs e) _

There you can use some thing like

if (e.CommandName.ToString().Equals("View"))
{
int currentRowIndex = Int32.Parse(e.CommandArgument.ToString());
}

Thursday, May 20, 2010

VS 2005 takes too much time to load

VS 2005 takes too much time to load when you open it or trying to open a project.

Go to Tools -- > Import and Export Settings
and select Reset Settings.

That should do it.

You can do it as often as you want