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

detail grid not expanding when modifying master data

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kunal
Top achievements
Rank 1
Kunal asked on 25 Nov 2017, 04:53 AM

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

 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 30 Nov 2017, 04:12 PM
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.
Tags
Grid
Asked by
Kunal
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or