detail grid not expanding when modifying master data

2 posts, 1 answers
  1. Kunal
    Kunal avatar
    8 posts
    Member since:
    Sep 2017

    Posted 24 Nov 2017 Link to this post

    Hi All,

     

    I'm using a RADGRID and the detail table is not expanding when i put this code below in. if i remove this code the detail grid expands without any issues with the correct data.

     

        Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
              If TypeOf e.Item Is GridDataItem Then
                   Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
                  If item("Status").Text = "Unknown" Then

                       item("Test").Text = ""
               End If
               End If
        End Sub

     

     

     

  2. Answer
    Vessy
    Admin
    Vessy avatar
    2062 posts

    Posted 30 Nov 2017 Link to this post

    Hi Kunal,

    The itemDataBound event is triggered for the items both in the Master and the detailed tables, so a server error will be thrown if the target columns are not presented in one of these tables. You have to make sure that the Name of the Master table are set and add an additional condition that will execute the provided logic only if the current item is in the master table/

    For example:
    Protected Sub gridAtestados_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs)
        If TypeOf e.Item Is GridDataItem And e.Item.OwnerTableView.Name = "MasterTableViewName" Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            If item("Status").Text = "Unknown" Then
                item("Test").Text = ""
            End If
        End If
    End Sub


    For convenience, I am attaching a very basic example where this suggestion is applied, so you can examine it at your end. I hope this helps.

    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top