Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: programmatic access to TemplateColumn class


Message #1 by "dragos s" <drag_os@y...> on Thu, 23 Aug 2001 14:26:29
I want to create a custom server control that uses the DataGrid control.

I have something like:



public class Grid : DataGrid

{

   public Grid()

   {

   .....

   }



   public ICollection CreateDataSource() 

   {

   .....

   }



   protected BoundColumn AddBoundColumn(String strHeaderText, String 

strDataField) 

   {

	BoundColumn bCol = new BoundColumn();



	bCol.HeaderText = strHeaderText;

	bCol.DataField = strDataField;

	return bCol;

   }



   public void OnLoad(Object s, EventArgs e)

   {

	this.DataSource = CreateDataSource();

	this.Columns.Add(AddBoundColumn("someText", "someField"));

	this.DataBind();

   }

}



This work fine if I have only columns of type BoundColumn but I want to 

add a TemplateColumn. Is there a way to do that ?



Thanks !

  Return to Index