adding template columns

understanding template columns

templates can be added programmatically. Look for ITemplate

Looks like datagrid has this capability through columns property. How about dataview? I dont see that property

apparently the templace column is replaced by templatefield

working with templatefields: msdn

an example from msdn api for templatefield

gridview reference

boundfield
buttonfield
checkbodfield
commandfield(select, edit, delete)
hyperlinkfield
imagefield
templatefield
rowstyle
headerstyle
alternatingrowstyle
footer
header
pager
selectedrow
showfooter
showheader

The above url has tons of information

RowCreated - you can change the appearance
RowDataBound - you can change data
SelectIndexChanged
SelectIndexChanging

adding a databind event to a control


// Override the ITemplate.InstantiateIn method to ensure 
// that the templates are created in a Literal control and
// that the Literal object's DataBinding event is associated
// with the BindData method.
public void InstantiateIn(Control container)
{
    Literal l = new Literal();
    l.add_DataBinding(new EventHandler(this.BindData));
    container.get_Controls().Add(l);
} //InstantiateIn

// Create a public method that will handle the
// DataBinding event called in the InstantiateIn method.
public void BindData(Object sender, EventArgs e)
{
    Literal l = (Literal)sender;
    DataGridItem container = (DataGridItem)l.get_NamingContainer();
    l.set_Text(((DataRowView)container.get_DataItem()).
        get_Item(column).ToString());
} //BindData 

How can I get access to the templatefield and template class in the instantiate in method?

what are the capabilities of htmltable and when do you use it?

Can I replace a templatefield at run time?

example of a templatefield in aspx