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

DataBinding Issue

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 2
Bill asked on 15 Mar 2013, 09:10 PM
I have a RadGrid with a TemplateColumn that contains an ItemTemplate, InsertItemTemplate & EditItemTemplate.

I am getting the attached error.

My markup is as follows for the RadComboBox in the grid:
<telerik:GridTemplateColumn DataField="description" HeaderText="Service Type" UniqueName="ServiceType">
                                <ItemTemplate>
                                    <asp:Label ID="lblServiceType" runat="server" Text='<%# Eval("description") %>'></asp:Label>
                                </ItemTemplate>
                                <InsertItemTemplate>
                                    <telerik:RadComboBox ID="ServiceTypeDDLIns" runat="server" DataSourceID="SqlDataSource2"
                                        DataTextField="description" DataValueField="code" ValidationGroup="CarrierSvc"
                                        SelectedValue='<%#Bind("code") %>' />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="ServiceTypeDDLIns"
                                        ForeColor="Red" Text="*This field is required" runat="server" Display="Dynamic"
                                        ValidationGroup="CarrierSvc">
                                    </asp:RequiredFieldValidator>
                                </InsertItemTemplate>
                                <EditItemTemplate>
                                    <telerik:RadComboBox ID="ServiceTypeDDLEdit" runat="server" DataSourceID="SqlDataSource2"
                                        DataTextField="description" DataValueField="code" ValidationGroup="CarrierSvc"
                                        SelectedValue='<%#Bind("code") %>' />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="ServiceTypeDDLEdit"
                                        ForeColor="Red" Text="*This field is required" runat="server" Display="Dynamic"
                                        ValidationGroup="CarrierSvc">
                                    </asp:RequiredFieldValidator>
                                </EditItemTemplate>
                            </telerik:GridTemplateColumn>

My DataSource is as follows:
<asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:wmssql03Trident %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SelectServiceType" SelectCommandType="StoredProcedure"
        runat="server"></asp:SqlDataSource>

The results from my sql query is also attached with a column named "description".

I understand what the error means, but don't know why it is getting the error when I see the "description" column coming out in the SQL query.

Can someone please explain to me what I'm doing wrong so I can correct this? I am "dead in the water" with this right now and can't proceed testing until I get some insight what is the problem.....

Thanks in advance....
 

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Mar 2013, 06:36 AM
Hello,

For testing purpose, can you please set AutoGenerateColumns="true" and check how many columns it will generate?

Because this is the one of the best way to check the that grid able to find 'description' column or not.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Bill
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or