Ver Mensaje Individual
  #4 (permalink)  
Antiguo 30/09/2004, 10:51
miguelinso
 
Fecha de Ingreso: agosto-2004
Mensajes: 9
Antigüedad: 19 años, 8 meses
Puntos: 0
Yo he probado ésto y sólo me muestra la primera página. El contenido del namespace es el siguiente:

public class _default1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid MyDataGrid;
protected System.Web.UI.WebControls.Label lblEnabled;
protected System.Web.UI.WebControls.Label lblCurrentIndex;
protected System.Web.UI.WebControls.Label lblPageCount;
protected System.Web.UI.WebControls.Label lblCustom;
protected System.Web.UI.WebControls.Label lblPageSize;
protected System.Web.UI.WebControls.Label lblVirtual;
//protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected ComponentArt.Web.UI.Menu Menu1;

protected System.Data.DataSet dset= new DataSet();
protected System.Web.UI.WebControls.DataGrid DataGrid1;


private void Page_Load(object sender, System.EventArgs e)
{
// Introducir aquí el código de usuario para inicializar la página
if (!Page.IsPostBack)
EnlazaDatos();
}
private void EnlazaDatos()
{
OdbcConnection conexion;
OdbcCommand comando;
OdbcDataAdapter objDataAdapter;

//Comprueba que el usuario y password son correctos
AppSettingsReader rdr =new AppSettingsReader();
string strCadenaConexionBD = rdr.GetValue("ConexionBDASA",typeof(string)).ToStr ing();

conexion= new OdbcConnection();
conexion.ConnectionString=strCadenaConexionBD;
conexion.Open();

comando=new OdbcCommand();
comando.Connection=conexion;
comando.CommandText= "select terapia_id, terapia_descripcion from terapia order by terapia_id";

objDataAdapter = new OdbcDataAdapter(comando);
objDataAdapter.Fill(dset);

DataGrid1.DataSource=dset;
DataGrid1.DataBind();
objDataAdapter.Dispose();
comando.Dispose();
conexion.Close();
}

private void DataGrid1_PageIndexChanged(object source,System.Web.UI.WebControls.DataGridPageChang edEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
EnlazaDatos();
}



#region Código generado por el Diseñador de Web Forms
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: llamada requerida por el Diseñador de Web Forms ASP.NET.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Método necesario para admitir el Diseñador. No se puede modificar
/// el contenido del método con el editor de código.
/// </summary>
private void InitializeComponent()
{
this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEvent Handler(this.DataGrid1_PageIndexChanged);
this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexCh anged);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
{

}


}


Lo he traceado. La primera pagina se ve bien. Pinchas en el enlace para ver la segunda y ves que, tras quedarse la ejecución sin entrar en el if del método "Page_Load" me muestra una página en blanco.
Puede alguien ayudarme?
¿Cómo puedo hacer para que en vez de tener que navegar por las páginas de resultados pinchando en el enlace imagen ">" pudiera hacerlo con las letras del abecedario al pie de la tabla de resultados para así ir a los resultados que empiecen por la letra que me interese?