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;
- namespace System.Web.UI.WebControls
- {
- public static class Methods
- {
- public static void RenderConfiguration(this GridView grid)
- {
- grid.GridLines = GridLines.Both;
- grid.CellPadding = 5;
- grid.CellSpacing = 6;
- grid.Width = new Unit("100%");
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace WebApplicationForms
- {
- public partial class About : Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- GridView1.RenderConfiguration(); // chamando configuração padrão!
- GridView1.DataSource = new object[]{
- new {Id = 1, Nome = "GridView 1"},
- new {Id = 2, Nome = "GridView 2"},
- new {Id = 3, Nome = "GridView 3"},
- new {Id = 4, Nome = "GridView 4"},
- new {Id = 5, Nome = "GridView 5"}
- };
- GridView1.DataBind();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement