Hi,
I don't know about that release, but for the previousVersion 1.0.60914.0, it works fine to me with a page method that isn't static and is defined at codebehind of the same page as the CascadingDropDown control (or the containing page of the web user control).
The only thing I can't do is to call the method in an user control.
<asp:DropDownList ID="ddlIlhas" runat="server"> </asp:DropDownList>
<atlasToolkit:CascadingDropDown ID="ddlPanel" runat="server">
<atlasToolkit:CascadingDropDownProperties Category="Ilha" LoadingText="[A carregar...]"
PromptText="Escolher..." ServiceMethod="GetIlhas"
TargetControlID="ddlIlhas"/>
</atlasToolkit:CascadingDropDown>
# in codebehind
[WebMethod]
public CascadingDropDownNameValue[] GetIlhas(string knownCategoryValues, string category)
{
(...)
List<CascadingDropDownNameValue> nomeValores = new List<CascadingDropDownNameValue>();
foreach (Ilha ilha in ilhas)
{
nomeValores.Add(new CascadingDropDownNameValue(ilha.Descricao, ilha.IlhaID.ToString()));
}
return nomeValores.ToArray();
}
Does anyone know a way put it in a user control?
This is a known issue with the Beta - the code needs to be within the ASPX page, unfortunately.
Does anyone know of a work-around for this issue? I have posted and issue on codeplex about this:
http://www.codeplex.com/WorkItem/View.aspx?ProjectName=AtlasControlToolkit&WorkItemId=5707
What I really need to be able to do, is add some additional parameters when building my CascadingDropDownNameValue array. At first, I was going to store the parameters in the ViewState, but because the Page method is static, I can't access the ViewState. So I decided to put the parameters in a cookie, and get them that way using HttpContext.Current.Request.Cookies. No dice. The HttpContext.Current.Request.Cookies did not contain my cookie. Does anyone know of a way to do this without using Session State? This application will be in a web farm. Here is the method I am using to build my CascadingDropDownNameValue array:
<script runat="server"
[WebMethod]
[ScriptMethod( )]
public static CascadingDropDownNameValue[ ] GetProgramCodes( string knownCategoryValues, string category )
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[ ".provider" ];
string providerType = string.Empty;
string specialty = string.Empty;
if ( !object.ReferenceEquals( cookie, null ) )
{
providerType = cookie.Values[ "providerType" ];
specialty = cookie.Values[ "specialty" ];
}
List<ProgramCode> codes = AdminAccess.GetProgramCodes( providerType, specialty );
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>( );
foreach ( ProgramCode code in codes )
values.Add( new CascadingDropDownNameValue( code.Description, code.Code ) );
return values.ToArray( );
}
</script
No comments:
Post a Comment