[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2010-11-11
3
Medium Priority
?
433 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 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