Hi Telerik team,
I am trying to add htmlbutton to radgrid header instead of default text header. Below is my code.
void radgrid1_PreRender(object sender, EventArgs e)
{
HiddenField hdfSortcolumn1 = (HiddenField)this.Page.FindControl("hdfSortColumn");
RadGrid RadGrid1 = (RadGrid)Cache["radgrid1"];
foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns)
{
foreach (GridHeaderItem headeritem in RadGrid1.MasterTableView.GetItems(GridItemType.Header))
{
HtmlInputButton headerButton = new HtmlInputButton();
headerButton.Value = col.UniqueName;
Session["col"] = col.UniqueName;
string strColumn = col.UniqueName.Replace(" ", "%20");
string script = " document.getElementById('" + hdfSortcolumn1.ClientID + "').value = '" +
strColumn + "'; RefreshSort('" + Request.QueryString["ItemID"].ToString() + "');";
headerButton.Attributes["onclick"] = script;
headeritem[col.UniqueName].Controls.Add(headerButton);
}
}
}
But duplicate header names are coming one is normal text and another one is dynamically added htmlbutton.
How to remove the default header text and only displaying htmlinputbutton.
Hope I can hear from you soon.
Thank you
Pratap.K
I am trying to add htmlbutton to radgrid header instead of default text header. Below is my code.
void radgrid1_PreRender(object sender, EventArgs e)
{
HiddenField hdfSortcolumn1 = (HiddenField)this.Page.FindControl("hdfSortColumn");
RadGrid RadGrid1 = (RadGrid)Cache["radgrid1"];
foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns)
{
foreach (GridHeaderItem headeritem in RadGrid1.MasterTableView.GetItems(GridItemType.Header))
{
HtmlInputButton headerButton = new HtmlInputButton();
headerButton.Value = col.UniqueName;
Session["col"] = col.UniqueName;
string strColumn = col.UniqueName.Replace(" ", "%20");
string script = " document.getElementById('" + hdfSortcolumn1.ClientID + "').value = '" +
strColumn + "'; RefreshSort('" + Request.QueryString["ItemID"].ToString() + "');";
headerButton.Attributes["onclick"] = script;
headeritem[col.UniqueName].Controls.Add(headerButton);
}
}
}
But duplicate header names are coming one is normal text and another one is dynamically added htmlbutton.
How to remove the default header text and only displaying htmlinputbutton.
Hope I can hear from you soon.
Thank you
Pratap.K