AJAX :: Cascading Dropdowns After State Is Selected

Aug 13, 2010

I have 3 dropdowns in my VB.Net 3.5 web app. After a user selects a value from the first (let's call it Countries) the second (called States) should populate correspondingly. Dropdown three (cities) should also cascade down after a State is selected. The Countries and States dropdowns have SQL DataSources. The Cities dropdown has to call 2 procs (based on the selected State value) so it does not have a SQLDataSource. My question is, the code below works for Countries and States, however, I cannot ge the Cities to populate...

<asp:DropDownList ID="drpCountries" runat="server" DataTextField="CountryName" DataValueField="CountryId" DataSourceID="sdsCountries" AutoPostBack="true">
</asp:DropDownList>
<asp:SqlDataSource ID="sdsCountries" runat="server" ConnectionString="<%&#36; ConnectionStrings:MyConnectionString %>"
SelectCommand="SELECT * FROM [Countries] ORDER BY [CountryName] ASC"></asp:SqlDataSource>
<asp:UpdatePanel ID="updStates" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="drpStates" runat="server" DataTextField="StateName" DataValueField="StateId" AutoPostBack="true" DataSourceID="sdsStates">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="drpCountries" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:SqlDataSource ID="sdsStates" runat="server" ConnectionString="<%&#36; ConnectionStrings:MyConnectionString %>"
SelectCommand="SELECT * FROM [states] WHERE StateId = @StateID ORDER BY [StateName] ASC">
<SelectParameters>
<asp:ControlParameter ControlID="drpCountries" Name="StateID" PropertyName="SelectedValue" DefaultValue="" />
</SelectParameters>
</asp:SqlDataSource>

THIS DOES NOT WORK:

<asp:UpdatePanel ID="updCities" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="drpCities" runat="server" DataTextField="CityName" DataValueField="CityId" AutoPostBack="true">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="drpStates" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Protected Sub drpStates_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles drpStates.DataBinding
' Call some procs and get a DataSet
drpCities.DataSource = ds
drpCities.DataBind()
End Sub

View 2 Replies


Similar Messages:

AJAX :: How To Get New Data Using Cascading Dropdowns

Dec 23, 2010

I've been working on my first version of an ASP.NET app, using cascading dropdowns. I've got 2 dropdowns on a page.

However, the third major control on the page is a details view. It works fantastic, with the cascading dropdowns, to display information from the second dropdown, and allow the user to edit that data. All well and good. But now, in testing, I suddenly realized that I've got no way of displaying the details view if I want to let the user enter new data, which would show some information in the second drop down.

View 5 Replies

AJAX :: Cascading Dropdowns Using 'webservice'

Apr 13, 2010

This has totally spoiled my .net 4 vs2010 realease day happiness. Running Cascading dropdowns using 'webservice' asmx method. Everything worked on .3.5 and i solved the running 'code In page' method with this post. Method error 500 [URL] Thought I was sorted but seems the rules are totaly different for the 'webservice method'. For example where did ToolkitScriptManager come from Ive been using ScriptManager for years. Anyway below is the Webservice and Page code. Ive looked at and tried everything of the forum but all of it is pre .4. This is demo code, the real version has 3 dependant dropdowns and the lookups are used several times so it HAS to be a webservice. My current theroies are:

1. Permissions- dosent makes sense.
2. Something missing in web.config to enable webservices.
3. Something to do with placement of 'System.Web.Script.Services.ScriptService()>'

<%@ Page Language="VB" ValidateRequest="false" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<html xmlns="[URL]">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:DropDownList ID="DDListManufacturer" runat="server" CssClass="ddsearch" Width="140px">
</asp:DropDownList>
<asp:CascadingDropDown ID="DDListManufacturer_CascadingDropDown" runat="server" Category="Manufacturer"
PromptText="Select a manufacturer"
ServiceMethod="WebService.GetDropDownContents"
TargetControlID="DDListManufacturer"
ServicePath="WebService.asmx">
</asp:CascadingDropDown>
</form>
</body>
</html ............................................

View 3 Replies

AJAX :: Cascading Dropdowns Reload On Event Trigger?

Oct 15, 2010

I have three cascading dropdowns and two of them need to trigger something outside of the dropdowns, so I have OnSelectedIndexChanged events on them. So as to not reload the whole page when these items are triggered, I have all of this in an Update Panel.

Everything works fine -- the only issue that the client doesn't like is that the cascading dropdowns reload on the asynchronous postback.

View 3 Replies

AJAX :: Cascading Dropdowns - How To Add / Pass An Additional Variable To Dropdown

Jul 1, 2010

I have a working version of cascading dropdowns.

the code line that adds each item into dropdown is:

[Code]....

View 1 Replies

AJAX :: Cascading Dropdown List Where The Number Of Dropdowns Is Created Dynamically On The Page

Mar 7, 2010

I am using cascading dropdown list where the no of dropdowns is created dynamically on the page. The cascading drop downs are contained in a User Control. I need to call a method from the Parent page which will be executed when the values in one of the dropdowns change. The server side event is not firing as I have set AutoPostback property for the dropdownlists to be false. How can i make the Page event fired from the Selected index changed of the dropdowns keeping the autopostback property to be set as false.

View 5 Replies

AJAX :: How To Avoid Cascading Dropdowns To Call Their Service Methods On Every Postback Of The Page

Feb 24, 2011

I have three cascading dropdowns on my web page and they work fine. The issue I am facing is that there are other controls on the page which cause a postback and with each postback the cascading drop downs are being re-populated (service methods are called) which is becoming a performnace issue.

View 1 Replies

Web Forms :: Dropdowns Validations - Make Sure That User Has Selected Something From The Dropdowns Otherwise Can't Proceed

Dec 6, 2010

I am using panel to hide and display certain controls on a page, On one of my panel i have three drop down, all i want is to make sure that user has selected something from the dropdowns otherwise they cant proceed, i am using the requiredfield validator but its just not working

[Code]....

View 9 Replies

Web Forms :: Cascading Dropdowns Without Using The Webservice?

Mar 9, 2011

provide me the cascading dropdown code upto 3 levels without using the WebService .

View 1 Replies

JQuery :: Add Rows Dynamically To A Table And Populate Data In Cascading Dropdowns

Dec 3, 2010

Add rows dynamically to a table and poulate data in cascading dropdowns,I am using ASP.NET3.5,

View 2 Replies

AJAX :: Cascading Dropdown Selected Value?

Mar 22, 2010

I have a cascading dropdown which is dynamically created and does a postback based on a certain condition. How do i set the selected value after the postback

View 1 Replies

AJAX :: How To Set Selected Value For Cascading DropDown

May 7, 2015

<asp:DropDownList ID="ddlModuleName" runat="server" ClientIDMode="Static">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdlModule" TargetControlID="ddlModuleName" PromptText="Select Module" PromptValue="0" ServicePath="~/controls/WebService.asmx" ServiceMethod="GetModules" runat="server" Category="ModuleID" LoadingText="Loading..." />

I am binding the dropdownlist by using ajax cascading drop down now i need to preselect the dropdown value in code behind page in page load (for update operation) is it possible

View 1 Replies

AJAX :: Set Selected Value Cascading Dropdown From The Code Behind

May 24, 2010

Bit of a strange request but is it possible to set the selected value of a cascading dropdown in code? I have 2 dropdowns, the second is populated using the value of the first. Heres my markup:

<asp:DropDownList ID="ddlApplication" runat="server" CssClass="form"></asp:DropDownList>
<ajaxToolkit:CascadingDropDown
ID="cddApplication"
runat="server"
TargetControlID="ddlApplication"
Category="Application"
PromptText="[select an application]"
ServicePath="webservices/Application.asmx"
ServiceMethod="GetUserApplications" />
<asp:DropDownList ID="ddlDelegate" runat="server" CssClass="form" />
<ajaxToolkit:CascadingDropDown
ID="cddApplicationUser"
runat="server"
TargetControlID="ddlDelegate"
ParentControlID="ddlApplication"
Category="ApplicationRole"
PromptText="[select a user]"
ServicePath="webservices/ApplicationRole.asmx"
ServiceMethod="GetApplicationUsers" />

Basically I want to set the selected value of ddlApplication, then populate the ddlDelegate, then I want to set the selected value of ddlDelegate.

View 3 Replies

AJAX :: How To Disable Cascading Dropdown With Selected Value

Sep 10, 2010

I have a RadioButtonList and two cascading dropdown linked to corrspoding dropdown control. Based on radiobutton's selection, the cascading will be prepopulated with some values and one value is selected in both dropdown.

I want to disable the cascading dropdown/dropdown after values are filled and selected on selection of radiobutton selected in RadioButtonList.

I tried to disable it, but in that case dropdown is getting empty.

View 4 Replies

AJAX :: Cascading Dropdown Selected Value Not Working?

Feb 9, 2011

I have a web form where I have three dropdowns for Country State And City and there corresponding
ajaxToolkit:CascadingDropDowns.

The dropdowns are working perfectly fine with the web service methods. i.e country loading initially and then State as per selected Country and City as per the selected City.

The problem occurs when I try to set selected values in these dropdowns as per the Values previously saved.

The Country loads properly and the selected value is set according.

The State is filled as per the selected country but its selected value is not set.

The City is not loaded at all (as the state doesn't have a selected value)

The Code is as Follows:

[Code]....

View 1 Replies

AJAX :: Cascading Dropdownlist Maintain Selected Values?

Jun 10, 2010

I'm wanting to maintain the dropdownlist values that were selected when i use postbackurl with a button. They cascading dropdowns are on a masterpage in an accordion pane. I select the 3 vales in the ddl and then presss a button which redirects to the new content page.

I've been able to get the values using previousPage.master.fincontrol... but am then setting the selectedValue in the page_init of the conent page, but they aren't set when the page loads... does anyone know where to put the code to set the values?

View 2 Replies

AJAX :: Set The Selected Value Of Cascading Dropdownlist By Reading From A Textbox

Mar 21, 2011

I'd like to set the selected value of cascading dropdownlist by reading from a Textbox.Text value when the dropdownlist has been populated, is this possible?

View 3 Replies

MVC :: Need 2 Dropdowns Like State And City.City Dropdown Depands Upon On State Drop Down?

Sep 25, 2010

I have a scenario where I need 2 dropdowns like state and city.City dropdown depands upon on State drop down.Will you please tell me how to achieve it ASP.NET MVC?I found this article but not sure is there any alternate way to do?http://stephenwalther.com/blog/archive/2008/09/07/asp-net-mvc-tip-41-creating-cascading-dropdown-lists-with-ajax.aspx

View 1 Replies

AJAX :: Display Cascading Dropdown List Based On Checkbox List Selected Value

Nov 10, 2010

How can i generate dropdown lists based on what has been selected in the checckbox list. Below is an example of what i need. if the user selects the options day, lotID and waferID, then 3 cascading dropdown lists should be displayed. And then a gridview displays data based on what has been chosen in the dropdown lists.

Day
LotID
SlotID
WaferID
VendorID
ToolID
LocationDetected
ProcessStep
Stage
Precipe
WaferStartMaterial
WaferStartVendor
WaferStartLot
WaferDiameterCOA
WaferMapTitle
BreakPoint
BreakpointSide
BreakpointMeasurement

View 3 Replies

Forms Data Controls :: Gridivew Refreshes When Dropdowns Selected?

Feb 24, 2010

I have three parameters to search and the record is being populated on the gridview.

Paremeters are dropdown lists:

lstDepartment, lstSection, lstLocation

I used AutoPostBack to true for above dropdowns but the problem I am facing is when I select value in lstDepartment to show values in lstSection then gridview data refreshes and after that when I select lstSection to show values in lstLocation then again gridview refreshes.

What I want to do is to when I'll select dropdown one by one then gridivew display data when a Search button pressed.

I don't want to refresh gridview everytime on the basis of dropdown selection.

View 14 Replies

Dropdownlist - Convert A Bunch Of Dropdowns Into An Array Of Dropdowns?

Mar 11, 2011

I have 45 dropdown lists in my asp page. There are some methods that I can apply to all of these dropdowns. Is it possible to convert them into an array of dropdowns for ease of use?

View 2 Replies

How Get Selected Text For Cascading Dropdown

Jan 20, 2012

I am trying to get the selected text of a cascadingdropdown control. I search over web but with no luck.

View 2 Replies

AJAX :: Like To Display All City Of Selected State In Check Box So That User Can Choose Multiple Cities?

Mar 15, 2010

Since I am new to Ajax control kit so thought to ask this question,I need to know what controls should i use for the following requirement.I've a state Drop down on selection of state drop down i would like to display all city of selected state in check box so that user can choose multiple cities and would like check box control to display only 5 city name per row for example if there are 10 cities in one state it should show 2 rows with 4 city and one row for 2 city.

View 1 Replies

5 Cascading Dropdowns (Parent To Child And Child To Parent)?

Aug 26, 2010

Simple and blunt: my cascading dropdownlists clear when a postback occurs. Does anyone know a quick way around that?For more information, read on...

I have 5 dropdown lists that define a training class location and line of business: Site, Parent Client, Client, Program, Project I'm trying to build cascading dropdownlists that can work from any direction (i.e. select a site and all other lists are filtered by site...select a project and all other dropdown lists are filtered by project). I've built the SQL Select statement behind the lists that filters (accurately).

View 3 Replies

AJAX :: Add Dropdowns On The Client Side?

Apr 29, 2010

we have a scenario where there is one dropdown on the page now users can add new dropdowns just below the existing dropdown. how do we add dropdowns on the client side and then access the dropdowns on postback?.

and what type of controls do we need to acheive this.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved