.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Ajax cascading dropdown and passing querystring to webservice

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net


i am using Cascading dropdown, with following scenario.

a page "myPage.aspx" is loaded with a Querystring. [http://localhost/myVD/myPage.aspx?jobID=003]

this page contains 2 cascading dropdowns say state & City .  the idea is to fill the provinces Combo based on INCOMING querystring value "jobid".

also i have a webservice named "Mywebservice.asmx" which has webmethods to retrieve city based on jobID.

but since these webmethods are Contained in asmx . the querystring of the caller page is not visible to the webmetod of the service.

here's  snippet for reference/

public CascadingDropDownNameValue[] GetContainerByJobID(string knownCategoryValues, string category
            //StringDictionary categoryValues = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
            //string jobId  = categoryValues["JobID"];

           string  jobId

View Complete Post

More Related Resource Links

ASP.Net Dynamic Data - DropDownList Field Template with AJAX Cascading DropDown Extension

Hi all,   Have spent hours trying to create a Dynamic Data Field Template holding a DropDownList which is extended by the AJAX Cascading DropDown extension. Final form holds multiple cascading dropdown boxes. User selects Country (Land) then Postcodes, Counties (Provincie) are populated. Once postcode is selected then towns (Plaats) are populated.  The problem I am now facing is that the viewstate for the dropdown lists is not being saved/restored after an insert action or custom validation error. So basically the dropdown lists are being reset to their default values. Some code (if missing parts, just ask and I will post them) - Don't mind the code structures etc... needs some refactoring :) Attribute I created:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Data { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] sealed public class CascadingDropDownParametersAttribute : Attribute { //public string TargetControlID; // The ID of the DropDownList to populate. public string Category; // The name of the category this DropDownList represents. public string PromptText; // Optional text to display before the user has selected a value from the DropDownList. public string

Ajax Cascading Dropdown - no data



I have been trying to get started with Ajax Toolkit and have started with the Cascading Dropdowns. I am following this tutorial: http://www.nerdliness.com/article/2008/02/15/using-asp-net-ajax-cascadingdropdown-visual-basic-and-database

But I cannot my dropdown lists to populate with any data. The only difference from the tutorial code is that I am connecting to different tables (but I have tested each query to make sure it returns data).

I have no idea where to start trying to fix this issue. Any help is appreciated

Help with opening PDF from SQL05 Database from AJAX cascading DropDown



I am new to ASP.NET and AJAX. I have recently viewed the video tutorials on the Cascading Dropdowns, and applied that to my website. I am populating the dropdowns from 3 tables, and am wondering how i would be able to open pdf file from the sql database and display it in the browser. Can anyone provide me any suggestions? Thanks to all

Issue in Infopath 2007 browser form - cascading dropdown using owssvr.dll filter view


Referring the below link, I created a cascading dropdown. The parent dropdown has sharepoint list as datasource and the child dropdown has xml datasource that points to owssvr.dll filter view. The cascading drop down works fine in preview but throws error after publishing as admin approved form - "form cannot run the specified query" exception when trying to execute xml datasource i.e., when a value is selected in parent dropdown. The security is 'Full Trust". In the event viewer the error message states "401 unauthorised" for the user a/c. the xml data source is an approved udcx file and in central admin, have enabled cross domain for infopath service. I have tried different solution provided in tech forums but issue still exists. Not sure whether Im missing something. Can someone guide me in fixing this issue?

Link Reffered:



Cascading Dropdown Question



I have 2 parent child cascading dropdowns on my form. At present they work as normal so you can only select a value from the second once you've selected one from the first, otherwise it's disabled. Is it possible to show all values in the second if you haven't selected anything from the first? Does that make sense?


Ajax Cascading drop down method error 500!


Sorry to trouble you all with something that has already been posted a million times but I have tried everything I can and stuck with for about 10 days now. Please help. I have created 2 tables Categories, Subcategories.

Categories table has Category_ID(Primary Key) and "Category" fields. Subcat table has SubcatID(Primary Key, Sub_cat and Category_ID(Foreign Key). Here's the code of the asmx file.

Service methods used in ASPX file ServiceMethod="GetVendors" and ServiceMethod="GetContactsForVendor". Please help me find the source of the method erro 500 and I will be very greatful.

<%@ WebService Language="VB" Class="CascadingDropdown1" %>

Imports System.Web.Script.Services

Imports AjaxControlToolkit

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports System.Collections.Generic

Imports System.Collections.Specialized

Imports System.Data.SqlClient

<ScriptService()> _
Public Class CascadingDropdown1
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function GetVendors(ByVal knownCategoryValues As String, ByVal category As String) As Cascadi

Problem passing custom object returned by the same webservice among two separate projects

I am running into casting issue with this scenario: 1. I made a custom object lets call it EmployeeObject.  2. The Employee object is wrapped in the EmployeeWebservice.  3. I have a client application project lets call it EmployeeClientApplication and a class library called DoSomeWorkClassLibrary.  Both EmployeeClientApplication and DoSomeWorkClassLibrary reference the EmployeeWebService and need to be able to pass the EmployeeObject back and forth.  4. The EmployeeClientApplication also references the DoSomeWorkClassLibrary. 5. The employeeObject in the EmployeeClientApplication becomes EmployeeClientApplication.EmployeeWebService.EmployeeObject. 6. The employeeObject in the DoSomeWorkClassLibrary becomes DoSomeWorkClassLibrary.EmployeeWebService.EmployeeObject. 7. The DoSomeWorkClassLibrary has a method called DoSomeWork that takes an EmployeeObject. When I try to pass employeeObject from EmployeeClientApplication to DoSomeWorkClassLibrary by doing something like this: DoSomeWorkClassLibrary.DoSomeWork(EmployeeClientApplication.EmployeeWebService.EmployeeObject), I am getting Unable to convert EmployeeClientApplication.EmployeeWebService.EmployeeObject to DoSomeWorkClassLibrary.EmployeeWebService.EmployeeObject.  I have searched high and low to fix this issue, I have tried changing the namespace of the reference.cs file of the webservice in

ajax call to webservice

I am new to jquery and want to make a simple jquery ajax call to webservice. My webservice is running fine but I am unable to get the data through ajax and jquery. My code is <%@ Page Language="C#" AutoEventWireup="true" CodeFile="WS.aspx.cs" Inherits="WS" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"><title></title> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script  type="text/javascript"> $(document).ready(function() { $("#btGetDate").click(function() { //$("#dvDate").html("I am here"); $.ajax({ type: "POST", url: "WebService.asmx/GetDateTime", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $("#dvDate").html(msg); } }); }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <div id="dvDate"></div><input id="btGetDate" type="button" value="Get Date" /> </div> </form> </body>  

How to return back back to code behind file after cascading dropdown calling

Hi, I have a cascading dropdown. After the dropdown is populated(it is in another file)  i would like to return back to the original form where the control is placed. is there anyway of doing it

Ajax dropdown list not working

Dear All:I just implemented a simple Ajax drop down list. The problem I'm facing is that when I run the project I will not be able to select the values from drop down even though there are 4 values coming in. Here is my code:Default.aspx<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div > Name:<asp:DropDownList ID="colorValue" runat="server" OnSelectedIndexChanged="colorValue_SelectedIndexChanged" ></asp:DropDownList> <ajaxToolkit:DropDownExtender ID="DropDownExtender1" runat="server" TargetControlID="colorValue" DropDownControlID="DropPanel" > </ajaxToolkit:DropD

Passing Id to a querystring in a Listview Control

I have tried almost evrything and nothing seems to work,,, I dont see errors but the code is not firing when I bind in the properties of the button control ,,nor the code behind., much help is appreciated,,aspx<LayoutTemplate>                <table id="Table1"cellpadding="0" cellspacing="0" style="border-right: #000000 thin solid; border-top: #000000 thin solid;                                    border-left: #000000 thin solid; border-bottom: #000000 thin solid; background-color: #FFFFFF; border-width: 1px;"                                    width="100%" align="center">        <tr>            <td>                    <b>Matching Providers </b>        

Adding group header in the cascading dropdown

Hi,   I have a cascading drop down, and in one of the dropdown i want to add a group header.    i,e suppose if i list the names (of girls and boys) i want to group them in a dropdown say(Girls and Boys as header under them the names)   Girls aaa bbb ccc Boys ddd gggt   Can anybody please help me

How to disable Cascading Dropdown with selected value?

Hi 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. Please advise, how to do this. Thanks in advance.  

Passing Querystring Value into Gridview/Listview

I have a master-detail page consisting of a databound GridView and ListView. It's pretty standard - when you select a row in the GridView is shows up the ListView. The problem I'm running into is when I want to link to that page with a specific row pre-selected in both views. It seems like it should be easy enough, but I just can't figure it out. Currently, the ListView is connected to the GridView with a ControlParameter in the SelectCommand. Any assistance would be greatly appreciated. (Let me know if you need more info.)

Ajax Slideshow, webservice and database

Hey I would like to know if someone can please help meI would like to use the ajax slideshow extender and  getting the Image Url stored in a databaseso far my webserivice look like this..but I think im making a mistake somewhere..its not working<WebMethod()> _    Public Function GetSlides() As AjaxControlToolkit.Slide()        Dim Connection As SqlConnection        Dim DBCommand As SqlCommand        Dim newdt As New DataTable()        Dim SQLString As String        Dim TheCompanyID As String = "1242"        Dim myConn As String = (ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString)        Connection = New SqlConnection(myConn)        Connection.Open()        SQLString = "select CImageUrl, CImageDescription, CImageTitle  from Company_ImageGallery where CompanyID = @CompanyID"        DBCommand = New SqlCommand(SQLString, Connection)        DBCommand.Parameters.Add("@CompanyID", SqlDbType.Int).Value = TheCo

Cascading Dropdown Web Method Issue



I am having an intersting issue to which I have found no solution, obviously. I am using a web service to populate a couple cascading drop downs. Evereything looks correct to me but I am getting a [Method Error 500] when I run it all. I have the <System.Web.Script.Services.ScriptService()> added to the web service so that's not the problem. What I have found while playing with it is that if I remove the arguments from the web method (ByVal knownCategoryValues As String, ByVal category As String) then it works. This of course is not helpful as I am trying to populate multiple drop downs. I can find nothing on anyone else having this issue.

I am using .NET 3.5 and Ajax DLL version 3.02... 

Also of note is that I have another website, using the same .NET and Ajax versions and this code is working fine.

I have tried everything I can think of, including my last resort tactic of smashing my face on my keyboard, and nothing is working. I am at a loss. Any help would be appriciated. Thanks.

Drop Downs:

<asp:DropDownList runat="server" ID="ddlPlateType" Width="250px" />

<ajax:CascadingDropDown runat="server" ID="cddPlateType" TargetControlID="ddlPlateType"

Method error 500 on cascading dropdown


Why do I get a method error 500 on this code:

<asp:DropDownList cssclass="textbox" ID="ddlCountry" runat="server" />
<asp:RequiredFieldValidator Display="Dynamic" SetFocusOnError="True" ID="rfvCountry" runat="server" ControlToValidate="ddlCountry" ErrorMessage="*" InitialValue=""/>
<cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="ddlCountry" Category="Country"
    prompttext="Select country" ServicePath="/LocalCities.asmx" ServiceMethod="GetCountries">

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class LocalCities
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function GetCountries(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameVa

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend