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

Adding button in group heading along with GroupBy Text ?

1 Answer 75 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
D.SRINIVASA
Top achievements
Rank 2
D.SRINIVASA asked on 16 Jul 2011, 01:34 PM
Hi,

I am Srinivas,

In my project i have a RadGrid for Displaying Data from Backend Table. Here i am using GroupBy property for My RadGrid. Here i want to Place a Button in RadGrid Header Row along with GroupBy Text.

Here i was Displaying a GroupBy Text successfully. It shown in 1.Jpg Attached file. But along with text i want to Show the Button in RadGroupHeader Row. Like Shown in Attachment 2 (Example Only).

Here The following code for  Group Header Text 
If TypeOf e.Item Is GridGroupHeaderItem Then
Dim item As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
Dim groupDataRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
'Dim nodeCollection As IList(Of RadTreeNode)
item.DataCell.Text = ""
For Each column As DataColumn In groupDataRow.DataView.Table.Columns
If column.ColumnName = "lot_id" And n >= 1 Then
item.DataCell.Text = RadTreeView1.CheckedNodes(item.GroupIndex).FullPath + "<br/>"
<Button Adding>
Dim hyplnk As New Button()
hyplnk.Text = "Redirect"
item.DataCell.Controls.Add(hyplnk)</button>
Else
item.DataCell.Text = RadTreeView1.CheckedNodes(item.GroupIndex).FullPath
End If
Next
End If
But it is not working fine..
Please Help me.

Thanks
D.Srinivas

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Jul 2011, 05:38 AM
Hello Srinivasa,

Try the following code snippet to add a button control in group header.
VB:
Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs)
    If TypeOf e.Item Is GridGroupHeaderItem Then
        Dim item As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
        Dim btn1 As New Button()
        btn1.ID = "Button1"
        btn1.Text = "START JOB"
        item.Cells(0).Controls.Add(btn1)
    End If
End Sub

Thanks,
Shinu.
Tags
ComboBox
Asked by
D.SRINIVASA
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or