IDR
IDR

Reputation: 11

Inserting data into multiple tables using single RadDataForm with EntityDataSource

I have a scenario where in I have to insert data into multiple tables using a single RadDataForm with EntityDataSource

Following are the three tables and Columns ComType: Id, ConType

ContactDetail: Id, ContactName, City

ContactCom: Id, ContactDetailsId, ComTypeId, ComValue

The point is I am able to insert into single table but not able to insert into multiple tables.

[

<asp:Label ID="ComValueLabel3" runat="server" AssociatedControlID="ComValueTextBox" CssClass="rdfLabel rdfBlock" Text="ComValue"></asp:Label>
<telerik:RadTextBox ID="ComValueTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("ComValue") %>' WrapperCssClass="rdfInput" />

]1

Following is the syntax of calling other tables columns while insertion

    <asp:Label ID="ContactNameLabel2"runat="server"AssociatedControlID="ContactNameTextBox"
     CssClass="rdfLabel rdfBlock" Text="ContactName"></asp:Label>
<telerik:RadTextBox ID="ContactNameTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("ContactDetail.ContactName") %>' WrapperCssClass="rdfInput" />

<asp:Label ID="CityLabel2" runat="server" AssociatedControlID="CityTextBox" CssClass="rdfLabel rdfBlock" Text="City"></asp:Label>
 <telerik:RadTextBox ID="CityTextBox" runat="server" RenderMode="Lightweight" Text='<%# Bind("ContactDetail.City") %>' WrapperCssClass="rdfInput" />

EntityDataSource Code:

<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=sampleEntities" DefaultContainerName="sampleEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True"EntitySetName="ContactComs" EntityTypeFilter="ContactCom" Include="ContactDetail,ComType"></asp:EntityDataSource>

I am unable to call the columns of other tables which are in include method

Here I am attaching the sample DB and full code of my scenario

How can I accomplish this

Thanks In Advance

enter image description here

Upvotes: 1

Views: 42

Answers (0)

Related Questions