DataBinding Issue

2 posts, 0 answers
  1. Bill
    Bill avatar
    175 posts
    Member since:
    Apr 2010

    Posted 15 Mar 2013 Link to this post

    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....
     
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 18 Mar 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top