Solved

AJAX cascadingDropDown SelectedValue bind Issue

Posted on 2008-06-21
5
1,555 Views
Last Modified: 2013-11-26
I have a CascadingDropDown  on my page and it works fine but when I Bind it to my SqlDataSource and try to update the database it throws an error. Aftersome research into the problem I found that the CascadingDropDown  Selectedvalue was returning DATAID:::DATAVALUE. With DATAID being the ID and DAVALUE being what shows in the DDL. So how do I get just the ID to Bind and not the rest. I have included the DDL and CDD just in case I messed up somewhere.

Thank You
<asp:DropDownList ID="DDLCat" runat="server" Width="199px" />

<cc1:CascadingDropDown ID="cddCertCat"  

runat="server"

TargetControlID="DDLCat" 

Category="Cat"

ServicePath="CertCatService.asmx"

ServiceMethod="GetCertCat"

SelectedValue='<%# Bind("CERTCATID") %>'

 />

Open in new window

0
Comment
Question by:NoSleepForTheWeary
  • 2
  • 2
5 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 21851124
For one, this is an asp.net question and should be put in the asp.net zone, this is likely why you were receiving no responses.

I don't see where you are setting the DataTextField and DataValueField of the DropDownList.  Are these being set somewhere else?  
0
 

Author Comment

by:NoSleepForTheWeary
ID: 21852953
yes as far as I know this is the code that sets the DataTextField and DataValueField
[WebMethod]
    public CascadingDropDownNameValue[] GetCertCat(string knownCategoryValues, string category)
    {

        dsCertCatTableAdapters.TBLCERTCATTableAdapter catAdapter = new dsCertCatTableAdapters.TBLCERTCATTableAdapter();
        dsCertCat.TBLCERTCATDataTable cat = catAdapter.GetCertCat();
        List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
        foreach (DataRow dr in cat)
        {
            string CatDesc = (string)dr["CERTCATDESC"];
            int CATID = (int)dr["CERTCATID"];
            values.Add(new CascadingDropDownNameValue(CatDesc, CATID.ToString()));
        }
        return values.ToArray();
    }

as per this instruction

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Walkthrough/CCDWithDB.aspx
0
 

Author Comment

by:NoSleepForTheWeary
ID: 21852966
P.S. Sorry I didnt add to the ASP.NET but not sure how to change it now lost my edit capability
TY
0
 
LVL 33

Accepted Solution

by:
raterus earned 500 total points
ID: 21855321
Sorry, I really don't know then.  I would suggest deleting this question and ask it again in the ASP.Net Zone, you should get much more experts to look at your question this time!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

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

21 Experts available now in Live!

Get 1:1 Help Now