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

[Solved] Issue with Add New

4 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jones
Top achievements
Rank 1
Jones asked on 26 Jul 2009, 12:54 PM
public class Details 
        public Int64 ID 
        { 
            get; 
            set; 
        } 
 
        public Contact Contact 
        { 
            get; 
            set; 
        } 
 
public class Contact 
 
        public string Title 
        { 
            get; 
            set; 
        } 
 
        public string FirstName 
        { 
            get; 
            set; 
        } 

I am binding the List<Details> object to grid. And I am having the below code in Grid Edit Template(popup). While editing its working fine. But during "AddNew" it showing error for "Contact".

<asp:TextBox ID="txtFirstName" Text='<%#  Eval("Contact.FirstName") %>' CssClass="txtBox" 
                                        runat="server"></asp:TextBox> 


Kindly give me a solution.

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 27 Jul 2009, 08:54 AM
Hi Jones,

Based on the supplied information, it is hard to determine the cause of the error that you mentioned. In order to progress in the resolution of this matter I will ask you to open a formal support ticket, and send us a small project, demonstrating the case, for further review.

All the best,
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.
0
Jones
Top achievements
Rank 1
answered on 27 Jul 2009, 10:07 AM
Aspx:

<telerik:RadGrid ID="rgJobUpdateContactDetails" runat="server"
<MasterTableView DataKeyNames="ID" EditMode="PopUp" CommandItemDisplay="Top"
<Columns> 
     <telerik:GridBoundColumn DataField="Contact.Title" HeaderText="Title"  /> 
     <telerik:GridBoundColumn DataField="Contact.FirstName" HeaderText="Name"/> 
</Columns> 
<EditFormSettings EditFormType="Template" PopUpSettings-Modal="true"> 
    <PopUpSettings Width="460px" Height="315px" /> 
    <FormTemplate> 
           <asp:TextBox ID="txtTitle" Text='<%#  Eval("Contact.Title") %>' CssClass="txtBox"  runat="server"
           <asp:TextBox ID="txtFirstName" Text='<%#  Eval("Contact.FirstName") %>' CssClass="txtBox"  runat="server"
    </FormTemplate> 
</EditFormSettings> 
</MasterTableView> 
</telerik:RadGrid> 


Code behind:

List<Details> objListDetails = new List<Details>();
Details objDetails = new Details();
objDetails.ID = 1;
objDetails.Contact = new Contact();
objDetails.Contact.Title = "Mr";
ObjDetails.Contact.FirstName = "Jones";
objListDetails.Add(objDetails);

radGrid1.DataSource = objListDetails
radGrid1.DataBind(); 

The issue is When I click the "Add New" button, I am getting the following error

DataBinding: 'Telerik.Web.UI.GridInsertionObject' does not contain a propertywith the name 'Contact'.

Kindly tell me a solution.

Thanks 
Jones
0
Jones
Top achievements
Rank 1
answered on 27 Jul 2009, 03:04 PM
Hi Pavlina,

Now Is my given data is understandable?

Thanks & Regards,
Jones
0
Pavlina
Telerik team
answered on 28 Jul 2009, 05:22 PM
Hi Jones,

Note that FormTemplate custom edit form is not supported with simple data-binding (calling DataBind()).
I suggest you switch to advanced binding with NeedDataSource event handling to see whether this helps.
More information is available in this link:
Form Template Edit Form

Sincerely yours,
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
Jones
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Jones
Top achievements
Rank 1
Share this question
or