Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. namespace System.Web.UI.WebControls
  6. {
  7. public static class Methods
  8. {
  9. public static void RenderConfiguration(this GridView grid)
  10. {
  11. grid.GridLines = GridLines.Both;
  12. grid.CellPadding = 5;
  13. grid.CellSpacing = 6;
  14. grid.Width = new Unit("100%");
  15. }
  16. }
  17. }
  18.  
  19. using System;
  20. using System.Collections.Generic;
  21. using System.Linq;
  22. using System.Web;
  23. using System.Web.UI;
  24. using System.Web.UI.WebControls;
  25. namespace WebApplicationForms
  26. {
  27. public partial class About : Page
  28. {
  29. protected void Page_Load(object sender, EventArgs e)
  30. {
  31. if (!IsPostBack)
  32. {
  33. GridView1.RenderConfiguration(); // chamando configuração padrão!
  34. GridView1.DataSource = new object[]{
  35. new {Id = 1, Nome = "GridView 1"},
  36. new {Id = 2, Nome = "GridView 2"},
  37. new {Id = 3, Nome = "GridView 3"},
  38. new {Id = 4, Nome = "GridView 4"},
  39. new {Id = 5, Nome = "GridView 5"}
  40. };
  41. GridView1.DataBind();
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement