This is a migrated thread and some comments may be shown as answers.

Automaticaly inserted spaces to Header in programmaticaly created Grid

2 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MexaHukyc
Top achievements
Rank 1
MexaHukyc asked on 17 Nov 2010, 11:45 PM
Hello All,
I've faced to problem, that in Q3 2010 for AJAX when I use programmatically created RadGrid, header text is changed against SQL datasource - automatically inserted spaces in string (e.g. "Order ID" instead of "OrderID", "NBREQ_ TCP" instead of "NBREQ_TCP").
Is there any way to avoid header text change in dynamic grid without static columns declaration? 

This code is used to fill Grig (DGrid) with data from DataSet (dst)
dtv = dst.Tables("SourceTable").DefaultView()
dtv.Sort = sortstring
 
DGrid.DataSource = dtv_stat
DGrid.DataBind()


Thanks,
MexaHukyc
.

2 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 23 Nov 2010, 11:31 AM
Hello MexaHukyc,

Please use the following code in order to implement the desired functionality:
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    RadGrid1.ColumnCreated += new GridColumnCreatedEventHandler(RadGrid1_ColumnCreated);
}
 
void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
    e.Column.HeaderText = e.Column.UniqueName;
}

I hope this helps.

Regards,
Mira
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
MexaHukyc
Top achievements
Rank 1
answered on 23 Nov 2010, 09:04 PM
Mira,
thanks for your answer, I've already solved the problem exactly this way.

BR,
MexaHukyc
Tags
Grid
Asked by
MexaHukyc
Top achievements
Rank 1
Answers by
Mira
Telerik team
MexaHukyc
Top achievements
Rank 1
Share this question
or