Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 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 ListadoTerminoArriendo : 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. //asignamos la fecha de hoy a la caja de texto
  18. txtFechaTermino.Text = DateTime.Now.ToShortDateString();
  19. //al cargar la pagina, mostramos todos los arriendos de esa fecha
  20. gvListado.DataSource = arriendo.listadoTerminoArriendo(Convert.ToDateTime(txtFechaTermino.Text));
  21. gvListado.DataBind();
  22. }
  23. }
  24.  
  25. protected void btnBuscarArriendo_Click(object sender, EventArgs e)
  26. {
  27. cargarGrilla();
  28. }
  29.  
  30. private void cargarGrilla()
  31. {
  32. try
  33. {
  34. //cargamos el listado, según la fecha seleccionada en el calendario
  35. gvListado.DataSource = arriendo.listadoTerminoArriendo(Convert.ToDateTime(txtFechaTermino.Text));
  36. gvListado.DataBind();
  37. }
  38. catch (Exception ex)
  39. {
  40. lblMensaje.Text = "Ingrese una fecha valida";
  41. }
  42.  
  43. }
  44.  
  45. protected void gvListado_PageIndexChanging(object sender, GridViewPageEventArgs e)
  46. {
  47.  
  48. gvListado.PageIndex = e.NewPageIndex;
  49. cargarGrilla();
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement