Solved

Cascading DDL, Inside DetailsView, using MS Access and VB.NET/ASP.NET new records

Posted on 2010-11-11
3
425 Views
Last Modified: 2012-05-10
Very specific question - please read.

I have a DetailsView Control on my ASP.NET Page (VB NOT C#)
On my Form I have 2 drop down lists. DDL1 and DDL2 that come from 2 lookup tables that are not part of the main table. DDL2 cascades from DDL1. The Main table has 2 fields, DDL_fk1 and DDL_fk2 that take integer values from the DDLs on the form.
Using MSAccess for backend.

I have functioning cascading code and am able to load the values in the 2 DDLs just fine.

My problem is that if the record does not currently have values in the underlying fields, it throws an error. In other words, if there has NOT been a selection made for either DDL, they should load with DDL1 stating "Please Make a Selection" and DDL2 being disabled.

Instead, I get an error.

Please provide WORKING syntax and code examples.
0
Comment
Question by:DLockwood
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 34113691
How about this in the sample:

Protected Sub ddlPlacementTypes_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim ddlPlacementTypes As DropDownList = DirectCast(sender, DropDownList)
        If String.IsNullOrEmpty(ddlPlacementTypes.SelectedValue) Then
            Typeid = -1
        Else
            Typeid = ddlPlacementTypes.SelectedValue
        End If
        PlacementSubType_DS.SelectParameters(0).DefaultValue = Typeid
    End Sub

Note: There will appear a  link "ask a related question" in the Post Comment section for a closed question. Since this question is kind of related to previous question you can use that feature. This helps other experts to better understand your question and build upon the previous one.
0
 

Author Comment

by:DLockwood
ID: 34113788
I didn't know about the "ask a related question" link. Thanks.

Well, I am sure you never thought I would say it, but the page is completely functional and doing everything that it is supposed to do.

I have 9 other pages for different programs (other than crisiscare) that all use the same PlacementType and PlacementSubType cascading DDLS. So, now all I have to do is copy the functionality into all of the pages and test. Tedious but easy.

THANK YOU again for all of your help. I could not have done it without you!
0
 

Author Closing Comment

by:DLockwood
ID: 34113793
Awesome!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question