protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridColumnDescriptor col = new GridColumnDescriptor();
col.Name = "Find";
col.Width = 150;
this.GridGroupingControl2.TableDescriptor.Columns.Add(col);
this.GridGroupingControl2.TableDescriptor.VisibleColumns.Add(col.Name);
}
this.GridGroupingControl2.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(GridGroupingControl2_QueryCellStyleInfo);
}
void GridGroupingControl2_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)
{
if (e.TableCellIdentity.Column.Name == "Find")
{
HyperLink hypLink = new HyperLink();
hypLink.ID = "Find1";
hypLink.Text = e.Style.CellValue.ToString();
hypLink.NavigateUrl = "http://www.syncfusion.com/FAQ/WinForms";
hypLink.Target = "_blank";
TemplateClass mytemp = new TemplateClass(hypLink);
e.TableCellIdentity.Column.HeaderTemplate = mytemp;
e.Handled = true;
}
}
}
public class TemplateClass : ITemplate
{
private Control m_ctrlChildControl = null;
public TemplateClass(Control ctrlChildControl)
{
m_ctrlChildControl = ctrlChildControl;
}
public void InstantiateIn(Control container)
{
container.Controls.Add(m_ctrlChildControl);
}
}