Tengo un gridview donde muestro 10 registros por pagina, el total de los registros son 227 por el momento, y le puse un DropDownList para que el usuario elija cuantos registros quiere mostrar en pantalla, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 o los 227, y funciona bien, pero al seleccionar que muestre todos los registros el dropdownlist desaparece, como le hago para que siempre se mantenga visible?
Muchas gracias!
este es mi codigo:
Código:
Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated Try If e.Row.RowType = DataControlRowType.Pager Then Dim ddl As New DropDownList ddl.Items.Add("10") ddl.Items(0).Selected = True ddl.Items.Add("20") ddl.Items.Add("30") ddl.Items.Add("40") ddl.Items.Add("50") ddl.Items.Add("60") ddl.Items.Add("70") ddl.Items.Add("80") ddl.Items.Add("90") ddl.Items.Add("100") ddl.Items.Add(Label1.Text) ddl.Items(10).Value = Nothing ddl.AutoPostBack = True Dim pagetable As Table Dim li As ListItem = ddl.Items.FindByText(GridView1.PageSize.ToString()) If li IsNot Nothing Then ddl.SelectedIndex = ddl.Items.IndexOf(li) End If AddHandler ddl.SelectedIndexChanged, AddressOf ddl_selectedindexchange pagetable = e.Row.Cells(0).Controls(0) Dim cell As New TableCell cell.Controls.Add(New LiteralControl("Cantidad de registros a mostrar: ")) cell.Controls.Add(ddl) pagetable.Rows(0).Cells.Add(cell) End If Catch ex As Exception Label1.Text = ex.Message End Try End Sub Sub ddl_selectedindexchange(ByVal sender As Object, ByVal e As EventArgs) Try GridView1.PageSize = Integer.Parse((CType(sender, DropDownList)).SelectedValue) GridView1.DataBind() Catch ex As Exception Label1.Text = ex.Message End Try End Sub Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Selected Try Me.Label1.Text = e.AffectedRows Catch ex As Exception End Try End Sub