如何传递到CascadingDropDown ServiceMethod附加参数? [英] How to pass an additional parameter to CascadingDropDown ServiceMethod?
问题描述
我有两个链接 CascadingDropDowns
。两者都工作正常。
问题是,在底层Web方法这是用于 DropDwonList
提供值,我需要读取一个额外的参数。需要为DropDownList的设置默认项此参数。
I have two chained CascadingDropDowns
. Both are working fine.
The thing is that in the underlying web methods which are supplying values for DropDwonList
I need read one additional parameter. This parameter is needed for setting up the default item for dropdownlist.
我不知道如何来传递参数或阅读。
我在网上看了关于 ContextKey
属性上。但我不知道如何从的WebMethod
存取权限了。
I do not know how to pass that parameter or read it.
I've read on the Internet about the ContextKey
property. But I do not know how to acces it from the WebMethod
.
我试图到达会议通过 HttpContext.Current.Session
(希望我可以从中提取会议上,一些参数),但它接缝该会话为网页不同
和的WebMethod
。
I've tried to get to the session through HttpContext.Current.Session
(hoping that I could extract some parameter from the session) but it seams that the Session is different for the WebPage
and WebMethod
.
所以我在这里失去了,任何想法?
So I am lost here, any ideas?
推荐答案
您需要三样东西拿到ContextKey工作。
You need three things to get the ContextKey to work.
- 设置的 UseContextKey 属性的CascadingDropDown为true
- 更改您的WebMethod的方法签名接受contextKey参数:
- Set UseContextKey property on the CascadingDropDown to true
- Change the method signature of your webmethod to accept the contextKey parameter:
公共CascadingDropDownNameValue [] GetDropDownContents(
串knownCategoryValues,串类,串contextKey){...}
注:该参数必须的确切套管
-
设置使用JavaScript ContextKey。阿贾克斯CascadingDropDown公开的getter / setter此属性在DOM:
Set the ContextKey using JavaScript. The AJAX CascadingDropDown exposes getter/setter for this property in the DOM:
的document.getElementById('idOfCDDL')set_contextKey('valueyouwant');
心连心。
这篇关于如何传递到CascadingDropDown ServiceMethod附加参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!