2014-02-05 52 views

回答

3
BoundField boundfield = new BoundField(); 
boundfield.DataField = "Last Name"; 
boundfield.HeaderText = "Last Name"; 
boundfield.SortExpression= "LastName"; 
GridView1.Columns.Add(boundfield); 
1

東西沿着這些路線:

var column = new BoundField(); 
column.DataField = "LastName"; 
column.HeaderText = "Last Name"; 
column.SortExpression = "LastName"; 
GridView1.Columns.Add(column); 
1
protected void Page_Load(object sender, EventArgs e) 
     { 
      if (!IsPostBack) 
      { 
       var boundColumn = new BoundField(); 
       boundColumn.DataField = "LastName"; 
       boundColumn.HeaderText = "Last Name"; 
       boundColumn.SortExpression = "LastName"; 
       GVPictures.Columns.Add(boundColumn);     
       BindGridView(); 
      } 
     }