Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Saturday, March 24, 2012

CascadingDropDownList with parameters for the first dropdown contents

Hi,

I'm trying ot make use of the CascadingDropdown control but I'm having trouble figuring out how to pass the parameters I need to populate the initial (top level) DropDownList

For example, I have the following DropdownLists:

Program

SubProgram

I want the cascade to occur on the SubProgram.

The problem lies in populating the Program DropDownList. I need to populate it based on a couple integer values (ProducerID and ProductID).

How do I specify these values for use in the webmethod? I can't find any examples where the webmethod that populates the Parent DropDownList isn't doing some simple query like getting all makes of a car.

Hi,

You can use contextKey to pass additional parameters to the webmethod that is responsible for filled the dropdownlist.

Please refer to this thread: http://forums.asp.net/p/1159991/1919729.aspx#1919729

CascadingDropDownList - Adding KnownCategoryValues through code

I am using several Cascading Drop Down Lists.

Is there a way that I can add values to the knownCategoryValues and category parameters that get passed to the webmethods?

For example:

[

WebMethod(EnableSession =true)]
publicCascadingDropDownNameValue[] GetSkill(
string knownCategoryValues,
string category)
{
int SubSystem_ID =int.Parse(Session["PageSubSystem"].ToString());
StringDictionary kv =CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);

int Location_ID;
if (!kv.ContainsKey("Location") || !int.TryParse(kv["Location"],out Location_ID))
{
returnnull;
}

Sorry for the badly formatted code, but the Code Entry thing is not working.

Anyway, how would I add a "Key" of Location to the parameters? Would this have to be in the WebService, or can I add it from the web page?

Any help on this would be greatly appreciated!

Try to take a look at the following link about how to useAjax:CascadingDropDown with a Database for reference.
http://ajax.alpascual.com/Walkthrough/CCDWithDB.aspx
Wish this can help you.