Solved

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

Posted on 2010-11-11
3
423 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now