RE: Data List Insert new problem



Hi Ed,

Based on my understanding, you have the following controls on the page to
display some one-many datas:

** a dropdown that display the main records
** a datalist that display detailed info of main record(selected in
dropdown)

And your question here is how to make the textbox contains initial value(of
the PK of current main record) when user perform inserting(for child
colors), correct?

I'd suggest you poste a simplified aspx page template and some brief
description of how the controls will work together at runtime so as for me
to understand it more clearly. So far, I think the init value for
textbox(for inserting) can be got from two place:

1. Is the dropdownlist (since datalist's displaying record also come from
dropdownlist selection)

2. Is the DataList

If this is true, there are also multiple means:

1. Add Event handler for the textbox(for inserting) and it will query the
current selected dropdownlist item and retrieve the PK info from it

2. You can store the info into DataList during databinding and then let the
Textbox retrieve the value from the control(maybe a html hidden field)
later (like in #1)

If this is not quite clear, you can give me some html snippet and I'll try
providing some ideas depend on them.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: "Ed Dror" <edd@xxxxxxxxxxxxxxxx>
Subject: Data List Insert new problem
Date: Mon, 3 Mar 2008 13:00:35 -0800

Hi there,

I'm using Wisual Studio 2005 Pro with SQL server 2005 Dev on XP SP2

I have two tables
Generic Item table (GN_ID) PK
Color Table (Color_ID) PK and GN_ID FK
very simple one to many relationship (one Generic Item can have many
colors)

I created a Dropdown list that select items from Generic Item table
Then I created a Datalist control based on the GN_ID in the dropdown list
with Edit and new Button
Until here everything was very simple and work just fine

when I pick a Generic Item the data list show all color that belong to
this
item.

Now when you click on new button the GN_ID field become empty and I want
to
preserve that GN_ID
I don't want the user to enter the GN_ID every time they enter a new color
based on GN_ID from the Generic Table

Is there any way to read the GN_ID from cache?
Or create a trigger? if so how

Thanks,
Ed Dror





.


Loading