Solved

AJAX cascadingDropDown SelectedValue bind Issue

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

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…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

630 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