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

Multiple Group Header in RadGrid

1 Answer 98 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sumith
Top achievements
Rank 1
Sumith asked on 21 Jan 2013, 12:54 PM
Hi Experts,

I have created rad grid with  multiple group header and added the check box in  first grouping header (BATCH_ID).So i want to do,
when i check the   check box in first grouping header then to be selected (highlighted) the grid items belong to second group header (ITEM_NAME)



Grouping  at Design Level
<GroupByExpressions>
<!-- First Grouping Header -->
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldAlias="BATCH_ID" FieldName="BATCH_ID" HeaderValueSeparator=" : " />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="BATCH_ID" SortOrder="Ascending" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
<!-- Second Grouping Header -->
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldAlias="Name" FieldName="EMP_DISPLAY_NAME" HeaderValueSeparator=" : " />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="ITEM_NAME" SortOrder="Ascending" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression
</GroupByExpressions>

         Create Header control at run time
Private Sub CreateHeaderControls(ByVal e As GridItemEventArgs)
        If TypeOf e.Item Is GridGroupHeaderItem Then
            Dim item As GridGroupHeaderItem = e.Item
            If IsNumeric(item.GroupIndex.ToString()) Then
                item.DataCell.Controls.Clear()
                Dim check As New CheckBox()
                check.AutoPostBack = True
                check.ID = "CheckAll"
                AddHandler check.CheckedChanged, AddressOf check_CheckedChanged
                item.DataCell.Controls.Add(check)
            End If
        End If
    End Sub


Thanks

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 24 Jan 2013, 12:59 PM
Hello Sumith,

In order to implement such functionality you would have to use the GroupIndex. In the event handler you can do something like this:

Protected Sub check_CheckedChanged(sender As Object, e As System.EventArgs)
        Dim CheckBox = CType(sender, CheckBox)
        'Extract the groupIndex like shown below
        Dim groupIndex As String = DirectCast(CheckBox.NamingContainer, Telerik.Web.UI.GridGroupHeaderItem).GroupIndex
        'Iterate through the items in the grid and according to their GroupIndex select them
    End Sub

Please note that you would have implement logic that compares the GroupIndex of the item with the GroupIndex of the header and selects the items in the grid that match the criteria.

Kind regards,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Sumith
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or