The control above is initialized with this code. The italic properties are optional:
<ajaxToolkit:CascadingDropDown ID="CDD1" runat="server" TargetControlID="DropDownList2" Category="Model" PromptText="Please select a model" LoadingText="[Loading models...]" ServicePath="CarsService.asmx" ServiceMethod="GetDropDownContents" ParentControlID="DropDownList1" SelectedValue="SomeValue" />
- TargetControlID - The ID of the DropDownList to populate.
- Category - The name of the category this DropDownList represents.
- PromptText - Optional text to display before the user has selected a value from the DropDownList.
- PromptValue - Optional value set when PromptText is displayed.
- EmptyText - Optional text to display when the DropDownList has no data to display.
- EmptyValue - Optional value set when EmptyText is displayed.
- LoadingText - Optional text to display while the data for the DropDownList is being loaded.
- ServicePath - Path to a web service that returns the data used to populate the DropDownList. This property should be left null if ServiceMethod refers to a page method. The web service should be decorated with the System.Web.Script.Services.ScriptService attribute.
- ServiceMethod - Web service method that returns the data used to populate the DropDownList. The signature of this method must match the following:
[System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public CascadingDropDownNameValue[] GetDropDownContents( string knownCategoryValues, string category) { ... }
Note that you can replace "GetDropDownContents" with a naming of your choice, but the return type and parameter name and type must exactly match, including case. - ContextKey - User/page specific context provided to an optional overload of the web method described by ServiceMethod/ServicePath. If the context key is used, it should have the same signature with an additional parameter named contextKey of type string:
[System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public CascadingDropDownNameValue[] GetDropDownContents( string knownCategoryValues, string category, string contextKey) { ... }
Note that you can replace "GetDropDownContents" with a name of your choice, but the return type and parameter name and type must exactly match, including case. - UseContextKey - Whether or not the ContextKey property should be used. This will be automatically enabled if the ContextKey property is ever set (on either the client or the server). If the context key is used, it should have the same signature with an additional parameter named contextKey of type string (as described above).
- ParentControlID - Optional ID of the parent DropDownList that controls the contents of this DropDownList.
- SelectedValue - Optional value to select by default. This needs to exactly match the string representation of a value in the DropDownList.
'Programming > AJAX' 카테고리의 다른 글
[스크랩] AJAX사용을 위한 web.config 설정 (0) | 2010.04.26 |
---|---|
AJAX TOOL KIT 도구 상자에 설치하기 (0) | 2010.03.27 |
AJAX 1.0 설치하기 (0) | 2010.03.27 |