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
Solved

AJAX cascadingDropDown SelectedValue bind Issue

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 57
Javascript/JQuery - HtmlEncode (?) Ajax Result 1 65
location of a form 2 25
Input parameteres to DragOver 2 19
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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