Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Row expanded for a particular value
posted

I have 2-tiered hierarchical webgrid.

I want to expand only one parent row along with all its child row depending on a particular value in the parent row. 

For eg:

ID1       Name1       Salary1      Address1

           ChildName1        DOB1

           ChildName2        DOB2

ID2       Name2       Salary2      Address2

           ChildName1        DOB1

If Parent ID = 1, expand parent and childrows for Parent ID 1

 Is this possible?

Parents
No Data
Reply
  • 80
    posted

    I do something similar with my grid.  In the grids InitializeRow event, if there is a certain value in the row, then I will change the color of that row.  Yours would look something like this...

      Protected Sub ugYourGridName_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles ugYourGridName.InitializeRow
        If Not (e.Row.Cells Is Nothing) Then
          If e.Row.Band.Key.ToUpper = "ParentBandName" Then 'This would be the name you have given the parent band.  
                                                                                                  'You can also call it  by it's index - If e.Row.Band.Index = 0 Then
            If e.Row.Cells.FromKey("ColumnName").Text = "1" Then 'ColumnName is the name of the column whose value needs checked 
              e.Row.Expand(True)
            Else
              e.Row.Expand(False)
            End If
         End If
      End If
    End Sub

    Hope this helps,

    Rosemary

     

Children
No Data