How do you set the a column's headertext equal to a value from a row in the grid's datasource? Any row is fine, because the column I want the data from has the same value in every single row that gets returned. i.e. Here are some columns in the sqldatasource:
My sqldatasource returns a variable number of columns, usually around 50-60 or so clients. So I build them dynamically and might have R50_ClientName for example. It's kind of like a cross tab query. Employees are each row. The varaible # of columns represent active clients and whether or not that employee works for that client. So I want the header of those 50 columns to be the real name of the client. "ABC Foods" is the text I want which is in column R1_ClientName, I do not want "R1_Assigned" which is the name of the data field that the column is bound to. Here is how I build them:
Employee R1_Assigned R1_ClientName R2_Assigned R2_ClientName ...
Dave Yes ABC Foods No Coca Cola
Bill No ABC Foods Yes Coca Cola
John Yes ABC Foods No Coca Cola
My sqldatasource returns a variable number of columns, usually around 50-60 or so clients. So I build them dynamically and might have R50_ClientName for example. It's kind of like a cross tab query. Employees are each row. The varaible # of columns represent active clients and whether or not that employee works for that client. So I want the header of those 50 columns to be the real name of the client. "ABC Foods" is the text I want which is in column R1_ClientName, I do not want "R1_Assigned" which is the name of the data field that the column is bound to. Here is how I build them:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
GridBoundColumn boundColumn;
boundColumn =
new
GridBoundColumn();
this
.RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"R1_Assigned"
;
boundColumn.HeaderText = ???
// I want to set this equal to value from column: R1_ClientName