or
Hello,
I have a radGrid that populates with groups collapsed by default. The group header displays the group header title and aggregate count as expected. When a header is dragged to the GridGroupPanel, the new subgroup still has a header title, but the aggregate is lost for the new sub-group.
Here is a sample of my initial grouping:
Dim
expression
As
GridGroupByExpression =
New
GridGroupByExpression
Dim
gridGroupByField
As
GridGroupByField =
New
GridGroupByField
gridGroupByField =
New
GridGroupByField
gridGroupByField.FieldName =
"DGDesc"
gridGroupByField.HeaderText =
" "
gridGroupByField.HeaderValueSeparator =
" "
gridGroupByField.FormatString =
" <strong>{0}</strong> "
expression.SelectFields.Add(gridGroupByField)
expression.GroupByFields.Add(gridGroupByField)
gridGroupByField =
New
GridGroupByField
gridGroupByField.FieldName =
"ProspectusLnNo"
gridGroupByField.HeaderText =
" "
gridGroupByField.HeaderValueSeparator =
" "
gridGroupByField.FormatString =
" (Records: {0})"
gridGroupByField.Aggregate = GridAggregateFunction.Count
expression.SelectFields.Add(gridGroupByField)
radGridDocuments.MasterTableView.GroupByExpressions.Add(expression)
I had to add the GroupByFields first before adding the SelectField with the aggregate function or it would not work. Anyway:
When I try to modify the GroupsChanging event, the best I get is a blank subgroup:
If
e.Action = GridGroupsChangingAction.Group
Then
If
e.Expression.GroupByFields(0).FieldName <>
"ImgSRC"
Then
If
Not
IsGroupedByImgSRC(radGridDocuments.MasterTableView.GroupByExpressions)
Then
Dim
customerGroupField
As
GridGroupByField =
New
GridGroupByField()
customerGroupField.FieldName =
"ImgSRC"
customerGroupField.HeaderText =
" "
customerGroupField.HeaderValueSeparator =
" "
customerGroupField.FormatString =
" (Records: {0})"
customerGroupField.Aggregate = GridAggregateFunction.Count
e.Expression.SelectFields.Add(customerGroupField)
'e.Expression.GroupByFields.Insert(1, customerGroupField)
radGridDocuments.MasterTableView.GroupByExpressions.Add(e.Expression)
End
If
End
If
End
If
Thank you for any assistance.
function
showButton(){
var
btn = document.getElementById(
'<%=btnClientCont.ClientID%>'
);
btn.style.display =
"inherit"
;
}
<
div
>
<
asp:UpdatePanel
ID
=
"updatepanel"
runat
=
"server"
><
ContentTemplate
>
<
table
><
tr
><
td
>
<
telerik:RadListBox
runat
=
"server"
ID
=
"lstBox"
OnClientTransferred
=
"showButton"
>
</
telerik:RadListBox
>
</
td
></
tr
>
<
tr
><
td
><
telerik:RadListBox
></
telerik:RadListBox
></
td
>
<
tr
><
td
><
asp:Button
ID
=
"btnReset"
OnClick
=
"rebindAll"
/></
td
></
tr
>
</
ContentTemplate
><
Triggers
><
asp:AsyncPostBackTrigger
ControlID
=
"btnReset"
EventName
=
"Click"
/>
<
asp:PostBackTrigger
ControlID
=
"btnClientCont"
/></
Triggers
></
asp:UpdatePanel
></
div
>
<
div
><
input
type
=
"submit"
runat
=
"server"
onservercick
=
"btnContinue_Click"
id
=
"btnClientCont"
/></
div
>
Specified argument was out of the range of valid values. |
Parameter name: value |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. |
Parameter name: value |
Source Error: |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace: |
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values. |
Parameter name: value] |
System.Web.UI.WebControls.Unit..ctor(Double value, UnitType type) +8670187 |
System.Web.UI.WebControls.Unit.Percentage(Double n) +38 |
Telerik.Web.UI.AllDayAppointmentControl.GetWidth() +75 |
Telerik.Web.UI.AppointmentControl.CalculateSize() +75 |
Telerik.Web.UI.Scheduler.Views.AllDayLayout.CreateAppointmentControls(IEnumerable`1 slots, Boolean registerAppointmentControls) +1338 |
Telerik.Web.UI.Scheduler.Views.AllDayLayout..ctor(IEnumerable`1 slots, Boolean registerAppointmentControls, IComparer`1 appointmentComparer) +103 |
Telerik.Web.UI.Scheduler.Views.Timeline.TimelineLayout..ctor(IEnumerable`1 slots, Boolean registerAppointmentControls, IComparer`1 appointmentComparer) +45 |
Telerik.Web.UI.Scheduler.Views.Timeline.TimelineLayout..ctor(IEnumerable`1 slots, IComparer`1 appointmentComparer) +42 |
Telerik.Web.UI.Scheduler.Views.Timeline.RendererBase.CreateLayout(List`1 timeSlots) +83 |
Telerik.Web.UI.Scheduler.Views.Timeline.RendererBase.CreateInnerContentTable(Control container, IList`1 allTimeLineSlots) +332 |
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Renderer.CreateVerticalContent(SchedulerTopTable topTable) +404 |
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Renderer.GetInnerContent() +310 |
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Renderer.GetContent() +88 |
Telerik.Web.UI.RadScheduler.CreateContent() +221 |
Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +190 |
Telerik.Web.UI.RadScheduler.CreateChildControls() +33 |
System.Web.UI.Control.EnsureChildControls() +87 |
System.Web.UI.Control.PreRenderRecursiveInternal() +44 |
System.Web.UI.Control.PreRenderRecursiveInternal() +171 |
System.Web.UI.Control.PreRenderRecursiveInternal() +171 |
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 |
<telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="TimelineView" |
OnAppointmentDataBound="RadScheduler1_OnAppointmentDataBound" TimelineView-HeaderDateFormat="D" |
DataSourceID="dsEventsDataSource" Skin="Office2007" GroupBy="Room" GroupingDirection="Vertical" |
DayStartTime="08:00:00" DayEndTime="23:30:00" TimeZoneOffset="03:00:00" DataKeyField="Conf_ID" |
DataSubjectField="Conference_Name" DataStartField="Start" DataEndField="End" |
OverflowBehavior="Expand" ShowViewTabs="false" ColumnWidth="10px" Width="950px" |
Height="400px" CustomAttributeNames="Conf_ID" OnAppointmentCommand="RadScheduler1_OnAppointmentCommand" |
OnResourceHeaderCreated="RadScheduler1_ResourceHeaderCreated" RowHeight="40px" |
MultiDayView-NumberOfDays="2" RowHeaderWidth="100px" EnableDatePicker="false" |
ShowNavigationPane="false" AllowInsert="false" AllowEdit="false" AllowDelete="false"> |
<advancedform modal="true" /> |
<timelineview numberofslots="192" slotduration="0:15" columnheaderdateformat="h tt" |
timelabelspan="4" showinsertarea="false" /> |
<resourcetypes> |
<telerik:ResourceType KeyField="VideoEndPointId" Name="Room" TextField="Name" ForeignKeyField="VideoEndPointId" |
DataSourceID="dsRoomsDataSource" /> |
</resourcetypes> |
<resourceheadertemplate> |
<asp:LinkButton ID="btnRemove" runat="server" Text="X" CommandName="RemoveResource" |
CausesValidation="false" CssClass="ui-icon ui-icon-trash" Style="float: left" |
OnClientClick="return confirm('Are you sure you want to remove this room?')" /> |
<asp:Label ID="ResourceLabel" runat="server" /> |
</resourceheadertemplate> |
</telerik:RadScheduler> |
<asp:LinqDataSource ID="dsEventsDataSource" runat="server" OnSelecting="dsEventsDataSource_OnSelecting"> |
</asp:LinqDataSource> |
<asp:LinqDataSource ID="dsRoomsDataSource" runat="server" OnSelecting="dsRoomsDataSource_OnSelecting"> |
</asp:LinqDataSource> |
public partial class Test4 : System.Web.UI.Page |
{ |
public List<Glowpoint.VNOC.BusinessLayer.Room> Rooms { get { return (List<Glowpoint.VNOC.BusinessLayer.Room>)ViewState["Rooms"]; } set { ViewState["Rooms"] = value; } } |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!Page.IsPostBack) |
{ |
RadScheduler1.SelectedDate = DateTime.Parse("10/15/2009"); |
TimeSpan daySpan = DateTime.Parse("10/19/2009 6:30:00 AM") - RadScheduler1.SelectedDate; |
RadScheduler1.TimelineView.NumberOfSlots = (daySpan.Days + 1) * 96; |
Rooms = new List<Glowpoint.VNOC.BusinessLayer.Room>() |
{ |
new Glowpoint.VNOC.BusinessLayer.Room() { |
VideoEndPointId = new Guid("95d15340-a38b-4c06-970e-290019f2d7fb"), |
Name = "test1", |
Schedules = new List<RoomSchedule>() { new RoomSchedule() { Conference_Name = "TPX 2.0 Upgrade", PreTestTime = DateTime.Parse("10/15/2009 6:45:00 AM"), Start = DateTime.Parse("10/15/2009 7:00:00 AM"), End = DateTime.Parse("10/19/2009 6:30:00 AM"), Conf_ID = 158062, VideoEndPointId = new Guid("95d15340-a38b-4c06-970e-290019f2d7fb") } } |
} |
}; |
} |
} |
protected void RadScheduler1_OnAppointmentCommand(object sender, AppointmentCommandEventArgs e) |
{ |
if (e.CommandName == "RemoveResource") |
{ |
Guid roomId = new Guid(e.CommandArgument.ToString()); |
Rooms.Remove(Rooms.Single(r => r.VideoEndPointTypeId == roomId)); |
RadScheduler1.Rebind(); |
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "", "RemoveRoom('" + roomId + "');", true); |
} |
} |
protected void RadScheduler1_ResourceHeaderCreated(object sender, Telerik.Web.UI.ResourceHeaderCreatedEventArgs e) |
{ |
((Label)e.Container.FindControl("ResourceLabel")).Text = e.Container.Resource.Text; |
((LinkButton)e.Container.FindControl("btnRemove")).CommandArgument = e.Container.Resource.Key.ToString(); |
} |
protected void dsEventsDataSource_OnSelecting(object sender, LinqDataSourceSelectEventArgs e) |
{ |
List<RoomSchedule> schedules = new List<RoomSchedule>(); |
foreach (var room in Rooms) { schedules.AddRange(room.Schedules); } |
e.Result = schedules; |
} |
protected void RadScheduler1_OnAppointmentDataBound(object sender, SchedulerEventArgs e) |
{ |
if (e.Appointment.Subject == String.Empty) e.Appointment.BackColor = System.Drawing.Color.Red; |
} |
protected void dsRoomsDataSource_OnSelecting(object sender, LinqDataSourceSelectEventArgs e) |
{ |
e.Result = Rooms; |
} |
} |