Hola compañeros
necesito ayuda>
en una pagina web en un grid view quiero hacer una paginacion, pero no se como hacerle porque me sale error al momento que le doy clic cualquiera de los nuemros como se muestra la imagen
Este es mi codigo de aspx una cierta parte
<tr>
<td colspan="2" class="text">
<asp:GridView ID="Datos_ventas" runat="server" AutoGenerateColumns="true" AllowPaging="True"PageSize="100" OnPageIndexChanging="Generar_ventas_Click">
<PagerSettings Mode="NumericFirstLast"/>
</asp:GridView>
</td>
</tr>
este es el codigo de C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BD_Database; using System.Data; using System.Collections; using System.Web.UI.HtmlControls; public partial class Soporte_Reporte_Gasolineras_ventas : System.Web.UI.Page { public Connection _conDataBase = new Connection(ApplicationConfiguration.Instance.ConnectionString); public string strGasolinera_ID = ""; public StoredProcedure sp_call = null; public DataTable dt; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { strGasolinera_ID = Id_Gasolineras.SelectedValue.ToString(); //id_pemex = Id_Gasolineras.SelectedValue.Length; sp_call = new StoredProcedure("sp_Gasolinera_List", _conDataBase); DataTable dtgasolineras = new DataTable(); dtgasolineras = sp_call.getDataTable(); Id_Gasolineras.DataSource = dtgasolineras; Id_Gasolineras.DataTextField = "Nombre"; Id_Gasolineras.DataValueField = "Id"; Id_Gasolineras.DataBind(); } // Id_Gasolineras.Items.Insert(0, new ListItem("seleccione...", "-1")); } protected void Reportes_Ventas_Load(object sender, EventArgs e) { } public void Generar_ventas_Click(object sender, EventArgs a) { int id_pemex = Convert.ToInt32(Id_Gasolineras.SelectedValue.ToString()); string fecha_ini = Fecha_Inicial.Text; string fecha_finales = Fecha_Final.Text; DateTime fecha_inicio = Convert.ToDateTime(fecha_ini); DateTime fecha_fin = Convert.ToDateTime(fecha_finales); bool id_empresa = Orden_Empresa.Checked; bool ordenfecha = Orden_Cronologico.Checked; Importar_Detalles_ventas generar_detalles = new Importar_Detalles_ventas(); dt = generar_detalles.Detalles_ventas(id_pemex, id_empresa, fecha_inicio, fecha_fin, ordenfecha); Datos_ventas.DataSource = dt; Datos_ventas.DataBind(); dt = generar_detalles.Detalles_Consumo_total(id_pemex, fecha_inicio, fecha_fin); ConsumosTotal.DataSource = dt; ConsumosTotal.DataBind(); } }