.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

update/insert parent child at the same time

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
Hi Al, Is there a way to create a contact form that takes the name. address and other info for the master record; Then, somehow, on the same page, allow the user to enter multiple contact info as chid records (i.e. phone, email, etc.) All this using the Objec DataSource or SQL DataSource (which ever is easy) and doesn't require writing too much code. Any reference material welcomed. Thanks, rod.

View Complete Post

More Related Resource Links

Insert data in parent and child table at the same time


I have two (parent-child) tables that are bound by a primary key (PK)/foreign key (FK) relation.each PK is identity (idStudent and idBac)

to insert data, i'm using an little application in c# i programmed myself where i insert these columns for the Student table: F_Name, L_Name, Age, Mobile, Adresse, City ,and  ( i don't know how to handle the idBac wich is foreign key of the other table wich still not inserted yet)

for the table Bac, i insert section, school, and city.

what i want is when i click on "OK" button, the idBac ,wich is a foreign key of the other table (BAC), receives the same idBac given the moment i inserted the BAC informations too ...

i don't have any problem wich ado.net ...i just want the right query/procedure.

thanks in advance and sorry for my english, it's not my mother tongue.

Parent and child object insert through dataadapter

Hi,I have Parent(order)and child(Orderdetail) object how to  insert through dataadapter.Update() method in single shot.

Insert Parent and Child row in ONE Formview Dynamic Data


Hi All,

I am at my wits end and need some help, I have a dynamic data site, and have built a formview for my parent table, Claims (parent), Claims has a child table called DamagedVehicles, I want all the fields on the Cliams table and the fields on the DamagedVehicle to be displayed for insert on the same formsview, when the user fills in all data it should insert the claim and the damagedvehicle at the same time and set the foriegn key on the Damagedvehciles row to the Primary key of the claim, I dont know were to start any examples in VB.net or C# will be greatly appricated. i have been search for 3 days now trying to come to a solution and nothing has worked.

thanks in advance.

SELECT INSERT DELETE UPDATE happening at the same time


Hi All,
I have three table and SELECT DELETE INSERT UPDATE happening at the same time.
Join query is used for SELECT and DELETE.
INSERT and UPDATE no join query.
What are the actions to be taken to avoid deadlock. Will indexing help to resolve the dead lock.
Appreciate somebodys help immediately.



update value from Child page to parent page


hi all,

I am having 1 parent page associated with master page. From that parent page 1 child window is open. Now i enter some text into textbox & if i click on update button then text should be updated in parent textbox. & child window should be closed.

If i use Parent page without master page then its working fine but if i use Master page ,its not working. I think parent page object is not getting if i use Master page.

GridView Parent Child View with JQuery Effects

I was just checked how to add some more cool effects to the GridView control using JQuery. In this post I will display parent-child data in the GridView control with some help of the wonderful JQuery library.

Let's first populate the GridView control.

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

How to keep the hover for Parent menu and set the selected menu item css for child menu item?



I'm using cssfriendly control adapter for menu. My asp.net menu control's datasource is a sitemap file I'm using which contains all the urls.

I have the following questions:

  1. Is there a way to keep the parent menu item hovered while hovering over the respective child menu items?
  2. Is there a way to keep the child menu item selected? I am able to set the css for the parent menu, however I was wondering if the same is possible with the child items.

Please help! Smile


Moneka Smile

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

update parentpage gridview with the values from child page?


hi   i am having a gridview on each row i am having a update and add button.

on click of either of the button i am opening a popup where the end user will enter data and on clck of ok button in the child page

based on the click ie

if i clicked update i need to update that particular row with the values from child page.

if i clicked on add i need to add a row below the row where i clicked add button .

can anyone help me with this?

Two modalpopups as a parent-child


When I  open two modalpopups, one over another, there is unexpected order.

After click on "Open Parent Panel", and click on "Open Child Panel",

Child Panel (newone) is under the Parent. 

Uploaded with ImageShack.us

What should I do to get it in "normal order"?

The code is:

    <asp:ScriptManager ID="A" runat="Server">
    <asp:Button id="Z1"  runat="server" Text="Open Parent Panel" 

Display a nested child ListView on PostBack while using DataPager on parent ListView


Hello ASP.NET community,

I am having trouble finding how to solve the following issue :

I am using nested listviews to display Sales and Sales details.

The main ListView displays General Information about Sales and the child ListView displays the detailed information about one sale. the child listview is shown only when the user clicks on a link (see included code, DataBind is made on PageLoad) :

ASPX Markup Code :

<asp:listview id="lvSales" runat="server" onitemdatabound="lvSales_ItemDataBound">
<table cellspacing="0" border="1" width="250" style="border-collapse:collapse;">
<tr runat="server" id="headerRow">
<th scope="col" style="width:30px;"></th>
<th scope="col">SaleNumber</th>
<tr id="itemPlaceHolder" runat="server" enableviewstate="true"/>
<tr id="row" runat="server">
<td style="text-align:center;"><asp:button id="btnShowHideDetails" runat="server" oncommand=&qu

InfoPath and Access - two parent tables and one child table


Hi there,

I'm trying to link an InfoPath form to an Access database, I want to connect the InfoPath form to 3 tables in the Access database but InfoPath will only recognise parent-child relationships in a series (e.g. the "Company" table is the parent to the "Customer" table, which is again parent to the "Orders" table)

I need to have two parent tables and one child table, though (e.g. "Customer" is parent to "Orders", but "Inventory_Item" is also parent to "Orders"). Is there any way to establish this in InfoPath? I'm using Windows XP, InfoPath 2007 and Access 2007.

Cheers, Patrick

parent and child items


I have to create a aspx page where end users can create, edit and delete category and their subCategory from it.

Please suggest what is simple way to do above? using .Net

 PS: a category can have zero or more subcategory and subcategory will not have any of its own subcategory, i.e. there are only two levels.

Convert Update Date/Time to VB.NET



I was wondering if someone could convert this into VB.NET for me.  I'm not a PHP pro and not entirely sure what's happening here nor do I know how to get this to display the same way.

The new field is within a DetailsView, so you can give me example code as well, I'll greatly appreciate it.

Thanks.. -Jeff

PHP Code:

function updFormat($tStamp) {
	$tsTime = (strftime('%I', $tStamp) + 0) . strftime(':%M %p', $tStamp);
	// 86400 == # of seconds in a day
	$tsDays = floor($tStamp / 86400);
	$nowDays = floor(time() / 86400);
	if ($tsDays == $nowDays) $updTime = "Today at $tsTime";
	elseif ($tsDays == $nowDays - 1) $updTime = "Yesterday at $tsTime";
	else $updTime = strftime('%b ', $tStamp) . (strftime('%d', $tStamp) + 0) . strftime(', %Y' , $tStamp);

	return $updTime;
<asp:DetailsView ID="dtv_LastUpdated" runat="server" Width="100%" 
    AutoGenerateRows="False" DataSourceID="ods_MVPParcelUpdate" 
    CellPadding="1" CellSpacing="1" GridLines="None">
        <asp:BoundField DataField="Update_time" HeaderText="Parcel Data:" 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend