Solved

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

Posted on 2010-11-11
3
427 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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