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

RAD GRID issues

1 Answer 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 09 Feb 2009, 05:31 AM

Hi

I'm hoping I can resolve my problem here, if not I'll log a support call/ ticket.

I Have an application utilising the RAD Grid, the Grid consists of 4 dropdown lists with the values being populated from reference tables inside the main data set. (The grid has auto generate columns set to false).

The issue is that Every second line (the alternate line) doesn't render text - I've right clicked and 'Viewed Source" and in the table elements for the missing lines &nbsp is displayed additionally when I click the 'edit' link for a line where the data is missing the correct values are populated in the edit form, though when I click 'edit' for a line where the data is rendered no values are populated in the dropdown lists.

My first thought was a style sheet clash however given the table elements in View Source have &nbsp I don't believe this is the cause.

Another issue I've discovered is when I click 'edit' on a line that does render when the "ReadOnly" attribute is set to 'true' the RadGrid throws an application error stating: Object reference not set to an instance of an object


I've included the html from the aspx page below - showing the Rad Grid

  <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
        AutoGenerateColumns="False" AutoGenerateEditColumn="True" GridLines="None">  
        <HeaderContextMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </HeaderContextMenu> 
        <MasterTableView> 
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridDropDownColumn DataField="Delay_Code_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="Code" ListDataMember="RRD_011_DELAY_CODE" ListTextField="Delay_DS" 
                    ListValueField="id" ReadOnly="True" UniqueName="column">  
                </telerik:GridDropDownColumn> 
                <telerik:GridDropDownColumn DataField="COAL_SYSTEM_REPORT_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="Coal System" ListDataMember="RRD_008_DELAY_RESPONSIBILITY" ListTextField="DELAY_RESPONSIBILITY_NM" 
                    ListValueField="ID" UniqueName="column1">  
                </telerik:GridDropDownColumn> 
                <telerik:GridDropDownColumn DataField="REPORTING_SYSTEM_REPORT_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="Reprting System" ListDataMember="RRD_008_DELAY_RESPONSIBILITY" ListTextField="DELAY_RESPONSIBILITY_NM" 
                    ListValueField="ID" UniqueName="column2">  
                </telerik:GridDropDownColumn> 
                <telerik:GridDropDownColumn DataField="QT_DELAY_CATEGORY_ID" DataSourceID="dsdelaycodemapping" 
                    HeaderText="QT Delay Category" ListDataMember="RRD_015_DELAY_CATEGORY" ListTextField="DELAY_CATEGORY_NM" 
                    ListValueField="ID" UniqueName="column3">  
                </telerik:GridDropDownColumn> 
            </Columns> 
        </MasterTableView> 
        <FilterMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </FilterMenu> 
    </telerik:RadGrid> 

The Code behind  (...this is taken from a smaller solution I created in order to re-create the problem).
Imports System.Web.UI  
Imports System.IO  
Imports System.Xml  
Imports QR.TELERIKRADGRID.DataObjects  
 
Partial Public Class Index  
    Inherits SiteBasePage 'Inherits System.Web.UI.Page  
 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As EventArgs) Handles Me.Load  
        Try 
            If Me.IsPostBack = False Then 
 
                'Create an instance of our typed dataset and disable constraints.   
                Dim dsDelayCodeMapping As New dssDelayCodeMapping  
                dsDelayCodeMapping.EnforceConstraints = False 
 
                'Populate the dataset  
                dsDelayCodeMapping = Populate_DS(dsDelayCodeMapping)  
 
                'sets the RAD GRID DataSource  
                RadGrid1.DataSource = dsDelayCodeMapping  
            End If 
 
        Catch ex As System.Exception  
 
        End Try 
    End Sub 
 
    ''' <summary>  
    ''' Populates the Typed dataset from an XML document.   
    ''' The location of the XML Document will need to be set according to the individual machine that the solution  
    ''' is running on Modify the "strPath" value.   
    ''' </summary>  
    ''' <param name="dsDelayCodeMapping"></param>  
    ''' <returns></returns>  
    ''' <remarks></remarks>  
    Private Function Populate_DS(ByVal dsDelayCodeMapping As dssDelayCodeMapping) As dssDelayCodeMapping  
 
        'Specify the Location the XML document to read into the dataset.  
        Dim strPath As String = "D:\Projects\TELERIKRADGRID\TELERIKRADGRID\Web\" 
 
        'Read the XML Document into the dataset using the Generic readXML Function.   
        dsDelayCodeMapping.ReadXml(strPath & "XMLSTRING.xml")  
 
        Return dsDelayCodeMapping  
 
    End Function 
 
    ''' <summary>  
    ''' Required Function of RadGrid  
    ''' </summary>  
    ''' <param name="source"></param>  
    ''' <param name="e"></param>  
    ''' <remarks></remarks>  
    Private Sub RadGrid1_NeedDataSource(ByVal source As ObjectByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource  
 
        'Create an instance of our typed dataset and disable constraints.   
        Dim dsDelayCodeMapping As New dssDelayCodeMapping  
        dsDelayCodeMapping.EnforceConstraints = False 
 
        RadGrid1.DataSource = Populate_DS(dsDelayCodeMapping)  
 
    End Sub 
 
End Class 

If required I can Attach this smaller solution to any support ticket required, however I will be unable to do this until Wednesday.

Any assistance in the mean time will be greatly appreciated.

Cheers.
Daniel.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 12 Feb 2009, 07:54 AM
Hello Daniel,

I followed your scenario in order to replicate the issue but to no avail.
GridDropDownColumn is editable (implements the IGridEditableColumn interface) and provides, by default, GridDropDownListColumnEditor as its column editor.
This column type is useful for lookup fields from data tables. I suggest you to bind this column type on the following way: 
  • Set the DataField property to the name of a field in the data source of the table view that contains the column.
  • Set the DataSourceID property to the ID of a data source control for the lookup list. If the data source contains multiple tables, set the ListDataMember property to the name of the lookup table.
  • Set the ListTextField property to the name of the field in the lookup table that provides the text of items in the drop-down control.
  • Set the ListValueField property to the name of the field in the lookup table that supplies the value for the field specified by the DataField property.

More information about GridDropDownColumn is available on the following articles.
Column types
Customize/Configure GridDropDownColumn

I hope this information helps.

Regards,

Pavlina

the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or