Customize a header in DataGrid

D

David Lozzi

Hi,

I'd like to customize a header in a DataGrid. I want to add a link in the
header, as well as pull a recordset's ID. I am using a TemplateColumn so
that I can hold several lines of information in one column. The header is
now called General Information, I'd like to add an Edit, linked to another
page referencing the selected record's ID from a request. And because it is
a templatecolumn, I cannot use the built-in edit with DataGrid.

Thanks!
 
G

Guest

create your on header. handle the DataGrid_ItemCreated event and in that add
your custom controls in the header.

private void yourDataGrid_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
DataGridItem dgi = (DataGridItem)e.Item;
dgi.Cells[0].Controls.Add(new TextBox()) // your control/s goes here
}
}

also see
http://www.extremeexperts.com/Net/Articles/ExtendingDataGrid.aspx

Senthil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top