Solved

AJAX cascadingDropDown SelectedValue bind Issue

Posted on 2008-06-21
5
1,560 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
[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
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
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…

710 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