Problem with Select_RowCommand and GridView1_PageIndexChanging

Mar 23 2010 6:32 AM

Hi,
I have a problem with a gridview. The gridview have a column with buttonfield and this launch a 
protected
void Select_RowCommand(Object sender, GridViewCommandEventArgs e)
this select_RowCommand load many textbox.
This run well, the problem it´s that after execute the select_RowCommand the GridView1_PageIndexChanging NOT RUN, this not load records
 
The code for buttonfield columns is
ButtonField columLupa = new ButtonField();
columLupa.ButtonType =
ButtonType.Image;
columLupa.CommandName =
"Seleccionar";
columLupa.ImageUrl =
"~/imagenes/Buscar_mm.png";
columLupa.Text =
"SELECCIONAR CONTRATO";
columLupa.ItemStyle.HorizontalAlign =
HorizontalAlign.Center;
columLupa.ItemStyle.Width = 50;
 
the select_RowCommand
 
protected void Select_RowCommand(Object sender, GridViewCommandEventArgs e)
{
// If multiple buttons are used in a GridView control, use the
// CommandName property to determine which button was clicked.
if (e.CommandName == "Seleccionar")
{

int index = Convert.ToInt32(e.CommandArgument);

GridViewRow row = GridView1.Rows[index];
string contrato = Server.HtmlDecode(row.Cells[0].Text);
lbl_NomCliente.Text = contrato;

}
}
 
the PageIndexChanging
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataSource = pubs;
GridView1.DataBind();
}
 
Thanks for your help
Antonio

Answers (2)