Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using capaLogicaNegocio;
  8. namespace capaPresentacion
  9. {
  10. public partial class ListadoPorFechaArriendo : System.Web.UI.Page
  11. {
  12. CL_Arriendo arriendo = new CL_Arriendo();
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. //al cargar el sitio, dejamos como seleccionada la fecha actual
  18. txtFechaDesde.Text = DateTime.Now.ToShortDateString();
  19. txtFechaHasta.Text = DateTime.Now.ToShortDateString();
  20. gvListado.DataSource = arriendo.listadoPorFechaArriendo(Convert.ToDateTime(txtFechaDesde.Text), Convert.ToDateTime(txtFechaHasta.Text));
  21. gvListado.DataBind();
  22. }
  23.  
  24. }
  25.  
  26.  
  27. protected void btnBuscarEntreFechas_Click(object sender, EventArgs e)
  28. {
  29. cargarGrilla();
  30. }
  31.  
  32. private void cargarGrilla()
  33. {
  34. try
  35. {
  36. //cargamos el listado, según las fechas seleccionadas de los calendarios
  37. gvListado.DataSource = arriendo.listadoPorFechaArriendo(Convert.ToDateTime(txtFechaDesde.Text), Convert.ToDateTime(txtFechaHasta.Text));
  38. gvListado.DataBind();
  39. }
  40. catch (Exception ex)
  41. {
  42. lblMensaje.Text = "Ingrese una fecha valida";
  43. }
  44.  
  45. }
  46.  
  47. protected void gvListado_PageIndexChanging(object sender, GridViewPageEventArgs e)
  48. {
  49. gvListado.PageIndex = e.NewPageIndex;
  50. cargarGrilla();
  51.  
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement