Cartoon Head
Top achievements
Rank 1
Cartoon Head
asked on 02 Aug 2010, 05:13 PM
Has anyone successfully used RadAjaxManager to trigger a series of cascading combo boxes?
I have 3 RadCombo boxes setup, each with their own matching SQLDataSource.
Changing cboContentAreas triggers a refresh of cboAreasOfConcern.
Changing cboAreasOfConcern triggers a refresh of cboInterventionTools.
However, changing cboContentAreas does NOT cause a refresh of cboInterventionTools as well.
I thought maybe this would work (but it does not):
Is there a way to trigger a cascading refresh through the RadAjaxManager?
I will also need to do a fourth level of refresh... when they select a tool, it will need to trigger a refresh of 3 other combo boxes.. and all of that needs to happen when the first combo is changed.
I have 3 RadCombo boxes setup, each with their own matching SQLDataSource.
Changing cboContentAreas triggers a refresh of cboAreasOfConcern.
Changing cboAreasOfConcern triggers a refresh of cboInterventionTools.
However, changing cboContentAreas does NOT cause a refresh of cboInterventionTools as well.
I thought maybe this would work (but it does not):
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="cboContentAreas"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="cboAreasOfConcern" /> <telerik:AjaxUpdatedControl ControlID="cboInterventionTools" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="cboAreasOfConcern"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="cboInterventionTools" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> Is there a way to trigger a cascading refresh through the RadAjaxManager?
I will also need to do a fourth level of refresh... when they select a tool, it will need to trigger a refresh of 3 other combo boxes.. and all of that needs to happen when the first combo is changed.
7 Answers, 1 is accepted
0
Seth
Top achievements
Rank 1
answered on 02 Aug 2010, 05:46 PM
Can you post the rest of your aspx code? It would be helpful to see how you have it all setup.
0
Cartoon Head
Top achievements
Rank 1
answered on 02 Aug 2010, 06:02 PM
Default.aspx
Default.aspx.vb
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <!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> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="cboContentAreas"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="cboAreasOfConcern" /> <telerik:AjaxUpdatedControl ControlID="cboInterventionTools" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="cboAreasOfConcern"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="cboInterventionTools" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <div> Content Area<br /> <asp:SqlDataSource ID="sqlContentAreas" runat="server" ConnectionString="<%$ ConnectionStrings:RTIDesktop %>" SelectCommand="ContentAreas_List" SelectCommandType="StoredProcedure"> </asp:SqlDataSource> <telerik:RadComboBox AutoPostBack="true" Height="300px" Width="200px" runat="server" ID="cboContentAreas" DataSourceID="sqlContentAreas" DataTextField="ContentAreaName" DataValueField="ContentAreaID" ExpandDelay="0"> </telerik:RadComboBox> <br /> <br /> Areas of Concern<br /> <asp:SqlDataSource ID="sqlAreasOfConcern" runat="server" ConnectionString="<%$ ConnectionStrings:RTIDesktop %>" SelectCommand="AreasOfConcern_List" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="cboContentAreas" Name="ContentAreaID" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> <telerik:RadComboBox AutoPostBack="true" Height="300px" Width="200px" runat="server" ID="cboAreasOfConcern" DataSourceID="sqlAreasOfConcern" DataTextField="AreaOfConcernName" DataValueField="AreaOfConcernID" ExpandDelay="0"> </telerik:RadComboBox> <br /> Intervention Tool<br /> <asp:SqlDataSource ID="sqlInterventionTools" runat="server" ConnectionString="<%$ ConnectionStrings:RTIDesktop %>" SelectCommand="InterventionTools_List" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="hdnPersonID" Name="PersonID" PropertyName="Value" /> <asp:ControlParameter ControlID="cboAreasOfConcern" Name="AreaOfConcernID" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="hdnGradeLevelID" Name="GradeLevelID" PropertyName="Value" /> </SelectParameters> </asp:SqlDataSource> <telerik:RadComboBox AutoPostBack="true" Height="300px" Width="200px" runat="server" ID="cboInterventionTools" DataSourceID="sqlInterventionTools" DataTextField="InterventionToolName" DataValueField="InterventionToolID" ExpandDelay="0"> </telerik:RadComboBox> <br /> </div> <asp:HiddenField ID="hdnPersonID" runat="server" /> <asp:HiddenField ID="hdnGradeLevelID" runat="server" /> </form> </body> </html> Default.aspx.vb
Imports Telerik.Web.UI Partial Class Default2 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load hdnPersonID.Value = CLng(28172) hdnGradeLevelID.Value = CLng(8) End Sub End Class0
Seth
Top achievements
Rank 1
answered on 02 Aug 2010, 07:50 PM
The problem is not with the AjaxManager, but with dependencies. Because cboIntervnetionTools s not dependent directly on cboContentAreas, it does not get affected when cboContentAreas is changed.
Add a control parameter to sqlInterventionTools for cboContentAreas and it should work:
Add a control parameter to sqlInterventionTools for cboContentAreas and it should work:
<asp:ControlParameter ControlID="cboContentAreas" PropertyName="SelectedValue" />
0
Cartoon Head
Top achievements
Rank 1
answered on 02 Aug 2010, 08:15 PM
OK, that's not a perfect solution, but it will work.
Unless I'm mistaken, I need to give the parameter a name and then set up a matching "dummy" parameter in the SQL.
And then in the SQL declaration:
Again, not elegant, but under time constraints, I can live with that.
Thank you! It works perfectly now!
Unless I'm mistaken, I need to give the parameter a name and then set up a matching "dummy" parameter in the SQL.
<asp:SqlDataSource ID="sqlInterventionTools" runat="server" ConnectionString="<%$ ConnectionStrings:RTIDesktop %>" SelectCommand="InterventionTools_List" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="hdnPersonID" Name="PersonID" PropertyName="Value" /> <asp:ControlParameter ControlID="cboAreasOfConcern" Name="AreaOfConcernID" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="hdnGradeLevelID" Name="GradeLevelID" PropertyName="Value" /> <asp:ControlParameter ControlID="cboContentAreas" Name="DummyParameter" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource>And then in the SQL declaration:
ALTER PROCEDURE [dbo].[InterventionTools_List] ( @PersonID int , @AreaOfConcernID int , @GradeLevelID int , @DummyParameter int = NULL -- Not used, enables cascading combo boxes ) AS (etc.)Again, not elegant, but under time constraints, I can live with that.
Thank you! It works perfectly now!
0
Seth
Top achievements
Rank 1
answered on 02 Aug 2010, 08:18 PM
Glad it's working!
You actually don't need the dummy parameter. In my test I did not have one and it worked without it.
You actually don't need the dummy parameter. In my test I did not have one and it worked without it.
0
Cartoon Head
Top achievements
Rank 1
answered on 02 Aug 2010, 08:29 PM
Doesn't work for me. When I try this:
I get as ASP error:
Procedure or function InterventionTools_List has too many arguments specified.
... until I add that extra parameter to the SQL.
And then I get:
@ is not a parameter for procedure InterventionTools_List.
... until I give it a proper name on both sides.
Using VS 2008 (Version 9.0.30729.1 SP) with .NET 3.5 SP1 and SQL 2008.
Maybe something newer isn't as picky? Or I've got a setting in VS 2008 or SQL that's telling it to be picky?
<asp:SqlDataSource ID="sqlInterventionTools" runat="server" ConnectionString="<%$ ConnectionStrings:RTIDesktop %>" SelectCommand="InterventionTools_List" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="hdnPersonID" Name="PersonID" PropertyName="Value" /> <asp:ControlParameter ControlID="cboAreasOfConcern" Name="AreaOfConcernID" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="hdnGradeLevelID" Name="GradeLevelID" PropertyName="Value" /> <asp:ControlParameter ControlID="cboContentAreas" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource>I get as ASP error:
Procedure or function InterventionTools_List has too many arguments specified.
... until I add that extra parameter to the SQL.
And then I get:
@ is not a parameter for procedure InterventionTools_List.
... until I give it a proper name on both sides.
Using VS 2008 (Version 9.0.30729.1 SP) with .NET 3.5 SP1 and SQL 2008.
Maybe something newer isn't as picky? Or I've got a setting in VS 2008 or SQL that's telling it to be picky?
0
Seth
Top achievements
Rank 1
answered on 02 Aug 2010, 08:50 PM
That might be it, I am using Framework 4.0.