Just want to transfer value from variable to nother variable :
protected void gvVariableDetail_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow gvRow = gvVariableConfig.Rows[index];
int rowIndex = index;
}
}
But rowindex still have zero value, and index got row value(in these case i try edit row 2 and so index value is 1(start by 0)). so hope anyone know how to transfer index value to rowIndex.
You could use the
CommandSourceproperty and cast it’sNamingContainerto theGridViewRow. Then you can use it’sRowIndexproperty:If you want to use the
CommandArgumentyou have to set it from aspx:then this also works: