ExcelMLExportStylesCreated event fired I have following code:
if (style.Id == "itemStyle")
{
style.NumberFormat.FormatType = Telerik.Web.UI.GridExcelBuilder.
NumberFormatType.Currency;
style.AlignmentElement.HorizontalAlignment = Telerik.Web.UI.GridExcelBuilder.
HorizontalAlignmentType.Left;
style.InteriorStyle.Color = System.Drawing.
Color.WhiteSmoke;
style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.
InteriorPatternType.Solid;
}
else if (style.Id == "alternatingItemStyle")
{
style.NumberFormat.FormatType = Telerik.Web.UI.GridExcelBuilder.
NumberFormatType.Currency;
style.AlignmentElement.HorizontalAlignment = Telerik.Web.UI.GridExcelBuilder.
HorizontalAlignmentType.Left;
style.InteriorStyle.Color = System.Drawing.
Color.LightGray;
style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.
InteriorPatternType.Solid;
}
When the currency is set,its applied to every column which contain number including ServiceHours and ServiceMins.I need that curency applied only to PaidAmount column.But if I comment out style currency format,PaidAmount column trailing zero cuts off and no dollar sign appeared.
Please help me.Thanks
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<
telerik:RadScheduler AllowInsert="false" HoursPanelTimeFormat="hh:mm tt" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
OnAppointmentCreated="RadScheduler1_AppointmentCreated" runat="server" ID="RadScheduler1"
Skin="Office2007" Height="545px" CustomAttributeNames="StatusId" Width="690px"
ShowFooter="false" SelectedDate="2010-03-18" DayStartTime="07:00:00" DayEndTime="21:00:00"
FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" EnableDescriptionField="true"
ShowNavigationPane="false" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
DataSubjectField="1" DataStartField="1" DataEndField="1" ShowAllDayRow="false"
AllowEdit="false" DataKeyField="" DataDescriptionField="Description" OnTimeSlotContextMenuItemClicked="RadScheduler1_TimeSlotContextMenuItemClicked"
AllowDelete="false" OnAppointmentContextMenuItemClicked="RadScheduler1_AppointmentContextMenuItemClicked"
OnNavigationCommand="RadScheduler1_NavigationCommand" OnTimeSlotCreated="RadScheduler1_TimeSlotCreated">
<AppointmentContextMenuSettings EnableDefault="false" />
<TimelineView UserSelectable="false" />
<AppointmentTemplate>
<%
# Eval("Subject")%>
<br />
<asp:Label runat="server" ID="Teacher" />
<br />
<asp:Label runat="server" ID="Students" />
</AppointmentTemplate>
<AppointmentContextMenus>
<telerik:RadSchedulerContextMenu runat="server" DataTextField="Status" DataValueField="StatusId"
ID="SchedulerAppointmentContextMenu" AppendDataBoundItems="true">
<Items>
<telerik:RadMenuItem Text="Copy" Value="Copy" />
<telerik:RadMenuItem IsSeparator="True" />
<telerik:RadMenuItem Text="Edit" Value="Edit" />
<telerik:RadMenuItem IsSeparator="True" />
</Items>
</telerik:RadSchedulerContextMenu>
</AppointmentContextMenus>
<TimeSlotContextMenus>
<telerik:RadSchedulerContextMenu runat="server" ID="SchedulerTimeSlotContextMenu">
<Items>
<telerik:RadMenuItem Text="New Appointment" Value="New" />
<telerik:RadMenuItem IsSeparator="true" />
<telerik:RadMenuItem Text="Paste" Value="Paste" />
</Items>
</telerik:RadSchedulerContextMenu>
</TimeSlotContextMenus>
<TimeSlotContextMenuSettings EnableDefault="False" />
</telerik:RadScheduler>
</
ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
CS Page Code is Below.:-
protected
void RadScheduler1_TimeSlotContextMenuItemClicked(object sender, TimeSlotContextMenuItemClickedEventArgs e)
{
if (e.MenuItem.Value == "New")
{
//RadWindowManager1.Windows[0].Op
//Alert.Show("Chandan Kumar");
RadWindowManager windowManager = new RadWindowManager();
RadWindow widnow1 = new RadWindow();
// Set the window properties
//e.TimeSlot.Duration.
widnow1.NavigateUrl =
"~/Appointment/AppointmentDetails.aspx?FacilityId=" + ddlFacility.SelectedValue + "&StTime=" + e.TimeSlot.Start.Hour.ToString() + "&EndTime=" + RadScheduler1.DayEndTime.Hours.ToString() + "&appDate=" + RadScheduler1.SelectedDate.Date.ToString("dd/MM/yyyy") + "&appid=0&doctorId=" + ddlDoctor.SelectedValue + "&TimeInterval=" + RadScheduler1.MinutesPerRow.ToString() + "&FromTimeHour=" + e.TimeSlot.Start.Hour.ToString() + "&FromTimeMin=" + e.TimeSlot.Start.Minute.ToString() + "&Provider=" + ddlDoctor.SelectedItem.Text; ;
widnow1.Height = 500;
widnow1.Width = 700;
widnow1.Top = 40;
widnow1.Left = 100;
widnow1.ID =
"RadWindow1";
widnow1.OnClientClose =
"OnClientClose";
widnow1.VisibleOnPageLoad =
true; // Set this property to True for showing window from code
widnow1.Modal =
true;
widnow1.VisibleStatusbar =
false;
widnow1.Behavior =
WindowBehaviors.Close | WindowBehaviors.Move;
windowManager.Windows.Add(widnow1);
this.Form.Controls.Add(widnow1);
}
else if (e.MenuItem.Value == "Paste")
{
if (Convert.ToString(ViewState["CopyAppId"]) != "")
{
DAL.
DAL dl = new DAL.DAL(DAL.DAL.DBType.SqlServer, sConString);
Hashtable hshtableout = new Hashtable();
Hashtable hshtablein = new Hashtable();
hshtablein.Add(
"inyHospitalLocationId", Session["HospitalLocationID"]);
hshtablein.Add(
"intCopyAppointmentID", Convert.ToInt64(ViewState["CopyAppId"]));
hshtablein.Add(
"chrAppFromTime", e.TimeSlot.Start.Hour.ToString()+ ":" + e.TimeSlot.Start.Minute.ToString() );
hshtablein.Add(
"chrAppointmentDate", RadScheduler1.SelectedDate.ToString("dd/MM/yyyy"));
hshtablein.Add(
"intDoctorId", ddlDoctor.SelectedValue);
hshtablein.Add(
"intEncodedBy", Session["UserID"].ToString());
hshtableout.Add(
"intAppointmentNo", SqlDbType.Int);
hshtableout.Add(
"chvErrorStatus", SqlDbType.VarChar);
hshtableout = dl.getOutputParametersValues(
CommandType.StoredProcedure, "UspCopyDoctorAppointment", hshtablein, hshtableout);
//Cache.Remove("copyappointmentId");
//Alert.ShowAjaxMsg("Appointment Updated - " + hshtableout["intAppointmentNo"].ToString(), Page);
btnRefresh_OnClick(sender, e);
}
}
}
I am defining several columns through the RadGrid definition in the aspx file and several columns programatically in the page load event handler. The problem is that the programatically added columns don't work with sorting or filtering. The grid reloads, but the results are not sorted/filtered. If I define the column in the RadGrid definition instead of adding them programatically, they sort and filter correctly.
Columns defined in RadGrid definition:
<Columns>
<telerik:GridBoundColumn DataField="LeadDistributionId" ReadOnly="true" UniqueName="LeadDistributionId" Visible="true" />
<telerik:GridBoundColumn SortExpression="LeadDistributionType" HeaderText="Lead Distribution Type" DataField="LeadDistributionType" HeaderButtonType="TextButton" HeaderStyle-Width="150" ItemStyle-Width="150" FooterStyle-Width="150" />
<telerik:GridBoundColumn SortExpression="ProgramName" HeaderText="Program" DataField="ProgramName" HeaderButtonType="TextButton" />
<telerik:GridBoundColumn DataField="ProgramID" Visible="false" />
<telerik:GridBoundColumn SortExpression="SupplierName" HeaderText="Supplier" DataField="SupplierName" HeaderButtonType="TextButton" />
<telerik:GridBoundColumn DataField="SupplierID" Visible="false" />
<telerik:GridBoundColumn SortExpression="State" HeaderText="State" DataField="State" HeaderButtonType="TextButton" HeaderStyle-Width="150" ItemStyle-Width="150" FooterStyle-Width="150" />
<telerik:GridBoundColumn DataField="StateID" Visible="false" />
</Columns>
Columns defined programatically:
protected void Page_Load(object sender, EventArgs e)
{
// if this is the initial page request
if (!this.IsPostBack)
{
DataTable dtLeadDistributionSummary =
((
DataView)this.sdsLeadDistributionSummary.Select(new DataSourceSelectArguments())).ToTable();
Regex reCallCenterColumn = new Regex(LeadDistributionSummary.CallCenterColumnRegEx);
foreach (DataColumn dataColumn in dtLeadDistributionSummary.Columns)
{
// if this colummn is a call center column
if (reCallCenterColumn.IsMatch(dataColumn.ColumnName))
{
GridBoundColumn gridBoundColumn = new GridBoundColumn();
// when adding columns programatically in Page_Load event, column
// must be added to the columns collection before setting properties
this.RadGrid1.MasterTableView.Columns.Add(gridBoundColumn);
gridBoundColumn.UniqueName = dataColumn.ColumnName;
gridBoundColumn.DataField = dataColumn.ColumnName;
gridBoundColumn.HeaderButtonType =
GridHeaderButtonType.TextButton;
gridBoundColumn.HeaderStyle.Width = 150;
gridBoundColumn.ItemStyle.Width = 150;
gridBoundColumn.FooterStyle.Width = 150;
gridBoundColumn.Groupable =
true;
gridBoundColumn.AllowFiltering =
true;
// remove "CC-" prefix from column name for header text
gridBoundColumn.HeaderText = reCallCenterColumn.Replace(dataColumn.ColumnName,
"$2");
}
}
// hide grouped columns
foreach (GridGroupByExpression gridGroupByExpression in this.RadGrid1.MasterTableView.GroupByExpressions)
{
foreach (GridGroupByField gridGroupByField in gridGroupByExpression.GroupByFields)
{
this.RadGrid1.MasterTableView.GetColumnSafe(gridGroupByField.FieldName).Visible = false;
}
}
#region
expand first level
//// bind grid so items may be expanded below
//this.RadGrid1.Rebind();
//// loop through group headers
//foreach (GridGroupHeaderItem gridGroupHeaderItem in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
//{
// if (gridGroupHeaderItem.GroupIndex.Length == 1)
// {
// // expand the group
// gridGroupHeaderItem.Expanded = true;
// }
// else
// {
// gridGroupHeaderItem.Expanded = false;
// }
// Groups[gridGroupHeaderItem.GroupIndex] = gridGroupHeaderItem.Expanded;
//}
#endregion
expand first level
}
}