473,734 Members | 2,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ISSUE WITH AJAX CASCADING DROP DOWN CONTROL

I'm having issues populating a second drop down menu that's dependent
upon a selection in the first menu. When I select an option from the
first menu, the second menu remains disabled, i.e. unable to select an
option. I'm confident that most of my code is correct because of
testing that I completed with it. For instance, when I remove the
ParentControlID attribute from the second control and un-comment out:
// string sPlantTypeID = "2";
// int iPlantTypeID = LT.Utils.CInt(s PlantTypeID);

and comment out:
int iPlantTypeID;
if (!kv.ContainsKe y("PlantTypeDes cription") || !
Int32.TryParse( kv["PlantTypeDescr iption"], out iPlantTypeID))
{
return null;
}

I receive the data that I hope to in the second menu.

The one million dollar question is, what's causing the second menu to
not populate when an option is selected from the first menu?

Thanks for your help.
John

~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

<%@ Control Language="C#" AutoEventWireup ="true"
CodeBehind="pla ntgrid.ascx.cs"
Inherits="FPSwe b.usercontrols. plantgrid" %>
<%@ Register Assembly="AjaxC ontrolToolkit"
Namespace="Ajax ControlToolkit" TagPrefix="cc1" %>
<cc1:CascadingD ropDown ID="cddPlantTyp e" runat="server"
TargetControlID ="ddlPlantTypeI D" Category="Plant Types"
LoadingText="Lo ading Plant Types..." PromptText="Sel ect a Plant Type"
ServicePath="~/customcontrols/plantdetail.asm x"
ServiceMethod=" GetPlantTypes" />
<cc1:CascadingD ropDown ID="cddVarietyT ype" runat="server"
TargetControlID ="ddlVariety ID" Category="Varie ty Types"
LoadingText="Lo ading Plant Varieties..." PromptText="Sel ect a Plant
Variety" ServicePath="~/customcontrols/plantdetail.asm x"
ServiceMethod=" GetPlantVarieti es" ParentControlID ="ddlPlantTypeI D" />
<asp:ScriptMana ger ID="smCascading DropDown"
EnablePartialRe ndering="false" runat="server" />
<asp:DropDownLi st ID="ddlPlantTyp eID" runat="server" Width="326"></
asp:DropDownLis t><p />
<asp:DropDownLi st ID="ddlVarietyI D" runat="server" Width="326"></
asp:DropDownLis t>

using System;
using System.Data;
using System.Data.Sql Client;
using System.Web;
using System.Collecti ons;
using System.Collecti ons.Generic;
using System.Collecti ons.Specialized ;
using System.Web.Scri pt.Services;
using System.Web.Serv ices;
using System.Web.Serv ices.Protocols;
using System.Componen tModel;
using BusinessLayer;
using AjaxControlTool kit;

namespace FPSweb.customco ntrols
{
/// <summary>
/// Summary description for plantdetail
/// </summary>
[WebService(Name space = "http://tempuri.org/")]
[WebServiceBindi ng(ConformsTo = WsiProfiles.Bas icProfile1_1)]
[System.Web.Scri pt.Services.Scr iptService]
[ToolboxItem(fal se)]
public class plantdetail : System.Web.Serv ices.WebService
{
private string err;

#region methods

[WebMethod]
public CascadingDropDo wnNameValue[] GetPlantTypes(s tring
knownCategoryVa lues, string category)
{
DataTable dtPlantTable = Common.GetPlant Types(0, out err);
List<CascadingD ropDownNameValu evalues = new
List<CascadingD ropDownNameValu e>();
foreach (DataRow dr in dtPlantTable.Ro ws)
{
string sPlantTypeDescr iption =
(string)dr["PlantTypeDescr iption"];
int iPlantTypeID = (int)dr["PlantTypeI D"];
values.Add(new
CascadingDropDo wnNameValue(sPl antTypeDescript ion,
iPlantTypeID.To String()));
}
return values.ToArray( );
}

[WebMethod]
public CascadingDropDo wnNameValue[] GetPlantVarieti es(string
knownCategoryVa lues, string category)
{
StringDictionar y kv =
CascadingDropDo wn.ParseKnownCa tegoryValuesStr ing(knownCatego ryValues);

// string sPlantTypeID = "2";
// int iPlantTypeID = LT.Utils.CInt(s PlantTypeID);

int iPlantTypeID;
if (!kv.ContainsKe y("PlantTypeDes cription") || !
Int32.TryParse( kv["PlantTypeDescr iption"], out iPlantTypeID))
{
return null;
}

DataTable dtVarietyTable = Common.GetVarie ties(0,
iPlantTypeID, out err);

List<CascadingD ropDownNameValu evalues = new
List<CascadingD ropDownNameValu e>();
foreach (DataRow dr in dtVarietyTable. Rows)
{
string sVarietyDescrip tion =
(string)dr["varietyDescrip tion"];
int iVarietyID = (int)dr["varietyID"];
values.Add(new
CascadingDropDo wnNameValue(sVa rietyDescriptio n,
iVarietyID.ToSt ring()));
}

return values.ToArray( );
}

#endregion methods
}
}
Jan 4 '08 #1
0 1495

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1325
by: Scott McChesney | last post by:
I'm writing a Windows application for a client, and I've run into a problem I don't know how to solve. The UI is relatively simple - a listbox on the left (in a panel), and a third-party tab control on the right (also in a panel). The usual splitter bar, and all that good stuff. The tab control is set up to deal with drag/drop events, so that users can drag an item from the listbox over the tab control and have the tab control respond...
5
1723
by: Colin Walls | last post by:
I have been asked to produce a web catalogue of services and associated options, this eventually will be used for ordering the services. My initial thought was to use a set of cascading drop downs, select an option from the first fills the available options for the second and so on. Given the current buzz about Ajax this would seem an opportunity to try out some of its features. Could anyone point me at an example of what I am trying...
1
2469
by: AndiSmith | last post by:
Hi guys, I wondered if anyone could help me with this problem, or even shed some light on the direction I need to take to resolve it? I'm using .NET 2.0 (C# flavor) to build a large user-based website. I've created an AJAX based user control, which is dynamically placed on a page (once, or multiple times) if the user has the correct permissions to receive it. It contains two drop down lists - employee value and partner value; and a...
0
1167
by: robert | last post by:
I am using the new beta 2 ajax control toolkit. When using the cascading drop-down obviously the items in the lists are generated through javascript, I would like to access these items serverside on a postback, is this possible? At the moment when posting back the cascading dropdown the items collection contains only one item, the item selected.
3
2948
by: =?Utf-8?B?R2FyeSBM?= | last post by:
I've implemented a cascadingdropdown modeling the examples found on the web and that work fine on an initial data entry screen. What I can't seem to find an example of is after I've stored data and want to come back to the screen for editing how can I get the lists to populate and set the appropriate value? Any examples out there that I'm just not finding? Thanks!
1
1429
by: jrcapp | last post by:
Let's see if I can clearly explain what I am doing with AJAX. On my Web site, I have a TabContainer that has 2 TabPanels. Inside each Panel, I am dynamically (using a SQL query) creating an Accordion AJAX control that displays the content in each tab. On the Header of each Accordion, I am including a DropDownExtender control onto it. So, when someone hovers over the text "" a drop down will appear that they click on and their options...
3
1960
kcdoell
by: kcdoell | last post by:
Hello: I have been struggling with building a cascading list on a form that I created. My problem is that I am getting a "Datatype Mismatch in criteria expression" error that I can not seem to figure out. I hope someone can help... The background is that I have two drop down boxes on a form called: cboPolicyName cboPolicyNumber On the rowsource for the cboPolicyName I have it pointing to my table:
1
1356
by: JackInDaBox | last post by:
Hello, I am new to this and have run into a small problem. I am using the Ajax toolkit with VS 2005 to fill some drop downs through a web service and it works great. All of the cascading drop downs work correctly. The only problem I have is I need to copy the drop downs value from each cascading drop down into a hidden drop down. I have struggled with this for a few days now so if anyone could offer me some advice I would really appreciate...
3
3987
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment list will 'display in the drop down list of CboSegment With Me! If IsNull(Me!cboDivision) Then
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.