Adding button in group heading along with GroupBy Text ?

2 posts, 0 answers
    D.SRINIVASA avatar
    34 posts
    Member since:
    Oct 2010

    Posted 16 Jul 2011 Link to this post


    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.Text = RadTreeView1.CheckedNodes(item.GroupIndex).FullPath
    End If
    End If
    But it is not working fine..
    Please Help me.

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Jul 2011 Link to this post

    Hello Srinivasa,

    Try the following code snippet in ItemCreated event to add a Button control in group header.

    Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs)
        If TypeOf e.Item Is GridGroupHeaderItem Then
            Dim groupheader As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
            Dim btn As New Button()
            btn.ID = "btn1"
            btn.Text = "START JOB"
        End If
    End Sub

Back to Top