Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using capaLogicaNegocio;
- namespace capaPresentacion
- {
- public partial class ListadoPorFechaArriendo : System.Web.UI.Page
- {
- CL_Arriendo arriendo = new CL_Arriendo();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- //al cargar el sitio, dejamos como seleccionada la fecha actual
- txtFechaDesde.Text = DateTime.Now.ToShortDateString();
- txtFechaHasta.Text = DateTime.Now.ToShortDateString();
- gvListado.DataSource = arriendo.listadoPorFechaArriendo(Convert.ToDateTime(txtFechaDesde.Text), Convert.ToDateTime(txtFechaHasta.Text));
- gvListado.DataBind();
- }
- }
- protected void btnBuscarEntreFechas_Click(object sender, EventArgs e)
- {
- cargarGrilla();
- }
- private void cargarGrilla()
- {
- try
- {
- //cargamos el listado, según las fechas seleccionadas de los calendarios
- gvListado.DataSource = arriendo.listadoPorFechaArriendo(Convert.ToDateTime(txtFechaDesde.Text), Convert.ToDateTime(txtFechaHasta.Text));
- gvListado.DataBind();
- }
- catch (Exception ex)
- {
- lblMensaje.Text = "Ingrese una fecha valida";
- }
- }
- protected void gvListado_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- gvListado.PageIndex = e.NewPageIndex;
- cargarGrilla();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement