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

dynamic date header change ASAP

2 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kshitiz
Top achievements
Rank 1
Kshitiz asked on 03 Feb 2012, 11:37 AM
amm getting dates as 01-01-2012  02-01-2012  03-01-2012  04-01-2012  . . .. . . ..dynamically as headers in grid from directly binding with sp

am getting data as

name type blck  01-01-2012  02-01-2012  03-01-2012  04-01-2012  .  ... HEADERS

I WANT

Name  type blck  01  02   03      04.  ... as    HEADERS



<telerik:RadGrid ID="grdBlock" runat="server" GridLines="None" AllowFilteringByColumn="False"
                               AllowPaging="False" AllowSorting="False" AutoGenerateColumns="true" PageSize="25"
                               OnNeedDataSource="grdBlock_NeedDataSource" Skin="Office2007" CellSpacing="1" 
                               Width="900px" EnableLinqExpressions="false"  >
                               <GroupingSettings CaseSensitive="false"  />
                               <ExportSettings HideStructureColumns="true" IgnorePaging="true" FileName="Block"
                                   ExportOnlyData="true" OpenInNewWindow="true">
                                   <Excel Format="ExcelML" />
                               </ExportSettings>
                               <MasterTableView CommandItemDisplay="Top" AllowMultiColumnSorting="true" FilterItemStyle-HorizontalAlign="Center">
                                   <CommandItemSettings ShowExportToExcelButton="true" ShowExportToWordButton="false"
                                       ShowExportToPdfButton="false" ShowAddNewRecordButton="false" ShowRefreshButton="false" >
                                   </CommandItemSettings>
                                   <Columns >
                                        
                                          
                                   </Columns>
                               </MasterTableView>
                               <ClientSettings>
                                   <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                                   </Scrolling>
                               </ClientSettings>
                           </telerik:RadGrid>




my cs code is
 protected void grdBlock_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {

            DataSet result = new DataSet();
            BLEmployee bl_emp = new BLEmployee();
            PropertyEmployeeMaster prop_emp = new PropertyEmployeeMaster();
            try
            {

                prop_emp.Employee_Id = Convert.ToDecimal(ddlEmployeeName.SelectedItem.Value);

                DateTime selectedDate = RadMonthYearPicker1.SelectedDate.Value;
                DateTime startDate = selectedDate.AddDays((selectedDate.Day - 1) * -1);
                DateTime endDate = startDate.AddDays(DateTime.DaysInMonth(startDate.Year, startDate.Month) - 1);

             
                prop_emp.start_date = Convert.ToDateTime(startDate);
                prop_emp.end_date = Convert.ToDateTime(endDate);

              

                result = bl_emp.ReportMonthlyBlock(prop_emp);

                result = bl_emp.ReportMonthlyBlock(prop_emp);
               
}

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Feb 2012, 12:01 PM
Hello,

Try the following code.
c#:
protected void RadGrid1_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
{
 if (e.Column.UniqueName == "UniqueName")
  {
   e.Column.HeaderText = "your text";
  }
}
Also check the following help documentation.
Working with Auto-Generated Columns.

Thanks,
Princy.
0
Kshitiz
Top achievements
Rank 1
answered on 03 Feb 2012, 12:16 PM
i dont have a unique name is changed dynamcialy thru client side !
Tags
Grid
Asked by
Kshitiz
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kshitiz
Top achievements
Rank 1
Share this question
or