 |
| ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 1st, 2006, 02:36 PM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
DetailsView Issue.
Hi there,
I am using a GridView and displaying details in a Detailsview control. Now then I select a Row in the Gridview the details on for that record shows on the Detailsview control, but when there is/are not related records on the detailsview, the detailsview does not show at all. the functionality that I'm looking for is when I select a Row on the Gridview, if that specific record does not have a related record or the PrimaryKey does not exist on the details table, I want the detailsview to automatically goes on Insert Mode so the user can star creating detail records for the parent record.
Now, how can I tell when the detailsview control did not bring any records from the database?
Thanks very much.
Midway
|
|

September 15th, 2006, 10:48 PM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
|
|
Midway:
It would helpful to know how your database tables, in the parent-child relationship tables reference in your topic. However, my response is based on the relationship " each and every child (or detail record MUST belong or have one and only one Parent(master record). This would also means that a child record would not exist unless there was a Parent record, but a Parent record could exist, but no child/children records. Consider the following as part of the resolution:
1--As part of your Parent record you could highlight or underline or have a bit-switch to indicate the Parent or Master record is without the child or detail records.
2--Or displayed with each Parent record have an "Add Detail" Button if the Detail record already exist, then the "Add Detail"Button would be "grayed out".
One way to test the above: In a query, you could match the parent record with child record indicating a LEFT JOIN making a temp table, the query the temp table for blank child record. A Query, using the RIGHT JOIN will indicate blank parent records. I hope this did not confuse you more, if so email me.
I hope this helps.
|
|

November 29th, 2006, 06:55 PM
|
|
Registered User
|
|
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have the same question/issue that midway11 has, but would need to deal with it programmatically. Take the following scenario - I have an entry in the aspnet_users table after login and then want to create a corresponding record in a different table based on that username. If I automatically go directly to a detailsview to be able to edit/view the information it just returns a blank screen since there is no data yet in that second table, instead of being able to do an insert. How can you get it to do an insert if there is no data found in the select query for that detailsview?
Thanks, this is a very important issue I am trying to tackle.
|
|

November 30th, 2006, 05:35 AM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
|
|
drewid:
It is not clear from your scenario "the when" you would want this event to occur, right after the login? Do you use _VIEWSTATE? And/or Page_Init?
|
|

December 1st, 2006, 03:08 PM
|
|
Registered User
|
|
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Actually I would want to go to the detailsview after account creation (I am using the wizard). The FinishDestinationPageUrl would go to this page.
I am having issues getting this to default into an insert view, which would then go to a detail view after the insert. I can set the default to insert, but it then goes back to a blank insert screen after it inserts the record.
Ideal scenario:
1) Account is created
2) Next page is additional account details (I used the captured UserName on this page - is working fine)
3) The intial view on the additional account details page is an "insert" view so the additional account details record can be created in the corresponding table.
4) After insert it then takes me to a "details" view
*) Ideally I'd like to be able to use this same page to "insert" a record if no corresponding record exists; or "view" the information if a record does exist.
|
|

December 4th, 2006, 11:51 AM
|
|
Authorized User
|
|
Join Date: Sep 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi , first of all , u cant do it. Only empty data template is displayed when there is no data to bound.
So think of other way of design.If there is no data, then emptydata template is displayed.U can place button in that template with "add new data " text. Then u can make the details view to insert mode.
|
|
 |