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

[Solved] issue using comboBox in grid when edit

1 Answer 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gina
Top achievements
Rank 1
Gina asked on 24 Apr 2009, 04:36 PM
I am trying to load a comboBox when the grid goes into edit mode and everything I try comes back as DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'DisplayText'. the way that I am trying to bind it is by a sqlDataSource.

I have tried it many different ways and I am at a total loss... Can someone help ? 

Here is my grid
 <telerik:RadGrid ID="rgPRCA" runat="server"
                        DataSourceID="SqlDataSource1"
                        GridLines="None"
                        OnItemUpdated=rgPRCA_ItemUpdated
                        OnDataBound="rgPRCA_DataBound"
                        AllowPaging="True"
                        AllowSorting="True"
                        AutoGenerateEditColumn="false"
                        AllowAutomaticUpdates="True" >
    <ExportSettings>
    <Pdf PaperSize="Letter" FontType="Subset"></Pdf>
    <Excel Format="Html"></Excel>
    <Csv RowDelimiter="NewLine" ColumnDelimiter="Comma"></Csv>
    </ExportSettings>
    <MasterTableView CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR"
            Frame="Border" TableLayout="Auto"
            CommandItemDisplay="None"
            AutoGenerateColumns="False"
            DataKeyNames="Login"
            DataSourceID="SqlDataSource1">
    <RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" Visible="False">
    <HeaderStyle Width="20px"></HeaderStyle>
    </RowIndicatorColumn>
    <ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" Visible="False" Resizable="False">
    <HeaderStyle Width="20px"></HeaderStyle>
    </ExpandCollapseColumn>
    <Columns>
    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
            <ItemStyle CssClass="MyImageButton" />
        </telerik:GridEditCommandColumn>
        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Login"
            FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="Login"
            SortExpression="Login" UniqueName="Login" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Attendee"
            FilterListOptions="VaryByDataType" ForceExtractValue="None"
            HeaderText="Attendee" SortExpression="Attendee" UniqueName="Attendee">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Location"
            FilterListOptions="VaryByDataType" ForceExtractValue="None"
            HeaderText="Location" SortExpression="Location" UniqueName="Location">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Role"
            FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="Role"
            SortExpression="Role" UniqueName="Role">
        </telerik:GridBoundColumn>
        
        <telerik:GridDateTimeColumn UniqueName="CallDate" PickerType="DatePicker" HeaderText="CallDate"
            DataField="CallDate">
            <ItemStyle Width="120px" />
        </telerik:GridDateTimeColumn>
      
        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter"
            DataField="PassPhrase" FilterListOptions="VaryByDataType"
            ForceExtractValue="None" HeaderText="PassPhrase" SortExpression="PassPhrase"
            UniqueName="PassPhrase">
        </telerik:GridBoundColumn>
        // here is where I am having issues
          <telerik:GridDropDownColumn DataSourceID="sqlCallAttended" ListTextField="DisplayText" ListValueField="ValueText"
             SortExpression="DisplayText" HeaderText="CallAttended" DropDownControlType="RadComboBox"
            DataField="DisplayText">
        </telerik:GridDropDownColumn>

        
        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter"
            DataField="CallAttended" FilterListOptions="VaryByDataType"
            ForceExtractValue="None" HeaderText="CallAttended"
            SortExpression="CallAttended" UniqueName="CallAttended">
        </telerik:GridBoundColumn>
    </Columns>
<EditFormSettings ColumnNumber="2" CaptionDataField="Attendee" CaptionFormatString="Edit properties of {0}">
                    <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                    <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                    <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                        Width="100%" />
                    <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                    <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                        UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                    </EditColumn>
     <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
 </EditFormSettings>
</MasterTableView>
    </telerik:RadGrid>

here is what i have for SQL: it just returns ID, DisplayText, ValueText

 <asp:SqlDataSource ID="sqlCallAttended" runat="server"
        ConnectionString="<%$ ConnectionStrings:EDCCConnectString %>"
        SelectCommand="PRCA_GetCallAttendedList"
        SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>

I also have a RadManager
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgPRCA">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgPRCA" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
        Width="75px" Transparency="25">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0;" />
    </telerik:RadAjaxLoadingPanel>

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 27 Apr 2009, 03:30 PM
Hi Gina,

I followed your scenario in order to replicate the issue but to no avail. Attached to this post you will find sample application using GridDropDownColumn. Please examine it and let me know if it works for you.

Generally, the error you receive can be generated if the DisplayText field is not present in the dropdown column source (with id 'sqlCallAttended').

You can also visit the link below as another example of all RadGrid column types:
Column Types
Customize/configure GridDropDownColumn

Best regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Gina
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or