Search (web user control) using RadGrid, RadCombobox, RadTextBox, RadAjaxManager, RadScriptManager, RadStyleSheetManager, RadFormDecorator, SqlDataSource(s)
Background:
All controls are from RadControls for ASP.NET AJAX (not counting sqldatasources)
I've disabled ViewState, Embedded Scripts, Embedded Skins, Embedded Base Style Sheets and have added the necessary files to enable the WebBlue skin using RadScriptManager and RadStyleSheetManager.
The controls that comprise the search: Pairs of RadComboboxes (A filter RadComboBox with Ignore, Equals, Does Not Equal and the RadComboBox with the Selection to be filtered), the sqldatasources that populate them except for the ones that are load on demand, RadTextImputs, RadGrid and RadAjaxManager are part of a web user control that is being placed in a test page with the afore mentioned RadScriptManager and RadStyleSheetManager.
The SqlDataSource that's connected to the RadGrid is taking it's control parameter data from the SelectedValue of the RadComboBoxes and Text properties of the InputBoxes.
The stored procedure conneted to the SqlDataSource of the RadGrid can take any combination of paramters (logic in stored proc) and it's CancelSelectOnNullParameter property is set to False.
The RadComboBoxes have their AutoPostBack Properties set to True because there is codebehind that takes additional action when a selection is made (changes the SelectedValue of another RadComboBox to say pay attention to this parameter). To reduce page refresh, these RadComboBox triggers are managed by the RadAjaxManager. e.g. Select a state, and in the SelectedIndexChanged event of that control, the SelectedValue of its filter changes to = (with an additional option of !=).
I've also got SQL Server Profiler running to see what's actually being sent to the server.
The search button is set up in the RadAjaxManager to update the RadGrid.
Problem:
Only values from the RadTextBoxes are making it through to the Stored Procedure. Simply allowing the search button to do a full page postback wipes the values of the RadComboBoxes (but not the RadTextInputs). I've spent the last week+ going through property change combinations with no success. As a final test I included a pair of Standard DropDownLists and configured them the same way as the RadComboBoxes: Disabled viewstate, Created code for SelectedIndexChanged event, Wired up to RadAjaxManager. The standard DropDownLists worked as expeted and their values were passed to the SqlDataSource/Stored Procedure and reflected in the results of the RadGrid.
I'd only planned to use the RadComboBoxes where I needed their functionality, but standard DropDownLists create too much of a visual contrast. Now I've spent 2 weeks just trying to get this one page to work. It's a bit frustrating.
Question:
Why aren't the RadComboBox's selections/values being lost?
Side Note:
I can find No Way to make the Paging slider visible without the RadGrid's EmbeddedSkin being enabled.
Subset of Web User Control Code:
Subset of Code Behind:
Background:
All controls are from RadControls for ASP.NET AJAX (not counting sqldatasources)
I've disabled ViewState, Embedded Scripts, Embedded Skins, Embedded Base Style Sheets and have added the necessary files to enable the WebBlue skin using RadScriptManager and RadStyleSheetManager.
The controls that comprise the search: Pairs of RadComboboxes (A filter RadComboBox with Ignore, Equals, Does Not Equal and the RadComboBox with the Selection to be filtered), the sqldatasources that populate them except for the ones that are load on demand, RadTextImputs, RadGrid and RadAjaxManager are part of a web user control that is being placed in a test page with the afore mentioned RadScriptManager and RadStyleSheetManager.
The SqlDataSource that's connected to the RadGrid is taking it's control parameter data from the SelectedValue of the RadComboBoxes and Text properties of the InputBoxes.
The stored procedure conneted to the SqlDataSource of the RadGrid can take any combination of paramters (logic in stored proc) and it's CancelSelectOnNullParameter property is set to False.
The RadComboBoxes have their AutoPostBack Properties set to True because there is codebehind that takes additional action when a selection is made (changes the SelectedValue of another RadComboBox to say pay attention to this parameter). To reduce page refresh, these RadComboBox triggers are managed by the RadAjaxManager. e.g. Select a state, and in the SelectedIndexChanged event of that control, the SelectedValue of its filter changes to = (with an additional option of !=).
I've also got SQL Server Profiler running to see what's actually being sent to the server.
The search button is set up in the RadAjaxManager to update the RadGrid.
Problem:
Only values from the RadTextBoxes are making it through to the Stored Procedure. Simply allowing the search button to do a full page postback wipes the values of the RadComboBoxes (but not the RadTextInputs). I've spent the last week+ going through property change combinations with no success. As a final test I included a pair of Standard DropDownLists and configured them the same way as the RadComboBoxes: Disabled viewstate, Created code for SelectedIndexChanged event, Wired up to RadAjaxManager. The standard DropDownLists worked as expeted and their values were passed to the SqlDataSource/Stored Procedure and reflected in the results of the RadGrid.
I'd only planned to use the RadComboBoxes where I needed their functionality, but standard DropDownLists create too much of a visual contrast. Now I've spent 2 weeks just trying to get this one page to work. It's a bit frustrating.
Question:
Why aren't the RadComboBox's selections/values being lost?
Side Note:
I can find No Way to make the Paging slider visible without the RadGrid's EmbeddedSkin being enabled.
Subset of Web User Control Code:
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> | |
| <AjaxSettings> | |
| <telerik:AjaxSetting AjaxControlID="btnSearch"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| <telerik:AjaxSetting AjaxControlID="rcbState"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="rcbStateFltr" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| <telerik:AjaxSetting AjaxControlID="ddlStage"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="ddlStageFltr" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| </AjaxSettings> | |
| </telerik:RadAjaxManager> | |
| <asp:SqlDataSource ID="sqldsFilter" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="FlterLst" SelectCommandType="StoredProcedure" DataSourceMode="DataReader"></asp:SqlDataSource> | |
| <asp:SqlDataSource ID="sqldsState" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="StateLst" SelectCommandType="StoredProcedure" DataSourceMode="DataReader"></asp:SqlDataSource> | |
| <asp:SqlDataSource ID="sqldsStage" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="StageLst" SelectCommandType="StoredProcedure" DataSourceMode="DataReader"></asp:SqlDataSource> | |
| <asp:SqlDataSource ID="sqldsSearch" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="Search" SelectCommandType="StoredProcedure" CancelSelectOnNullParameter="False"> | |
| <SelectParameters> | |
| <asp:ControlParameter ControlID="txtCompany" Name="SearchCompanyName" PropertyName="Text" Type="String" ConvertEmptyStringToNull="False" /> | |
| <asp:ControlParameter ControlID="rcbState" Name="SearchCompanyState" PropertyName="SelectedValue" Type="String" ConvertEmptyStringToNull="False" /> | |
| <asp:ControlParameter ControlID="rcbStateFltr" Name="SearchCompanyStateFilter" PropertyName="SelectedValue" Type="Int32" /> | |
| <asp:ControlParameter ControlID="ddlStage" Name="SearchStageID" PropertyName="SelectedValue" Type="String" ConvertEmptyStringToNull="False" /> | |
| <asp:ControlParameter ControlID="ddlStageFltr" Name="SearchStageIDFilter" PropertyName="SelectedValue" Type="Int32" /> | |
| </SelectParameters> | |
| </asp:SqlDataSource> | |
| <telerik:RadTextBox ID="txtCompany" runat="server" EnableTheming="True" Skin="WebBlue" Width="150px" EnableEmbeddedBaseStylesheet="False" EnableEmbeddedScripts="False" EnableAjaxSkinRendering="False" EnableEmbeddedSkins="False" EnableViewState="False"></telerik:RadTextBox> | |
| <asp:DropDownList ID="ddlStageFltr" runat="server" DataSourceID="sqldsFilter" DataTextField="Filter" DataValueField="FilterID" EnableViewState="False"></asp:DropDownList> | |
| <asp:DropDownList ID="ddlStage" runat="server" AutoPostBack="True" DataSourceID="sqldsStage" DataTextField="Stage" DataValueField="StageID" EnableViewState="False" OnSelectedIndexChanged="ddlStage_SelectedIndexChanged"></asp:DropDownList> | |
| <telerik:RadComboBox ID="rcbStateFltr" runat="server" DataSourceID="sqldsFilter" Skin="WebBlue" Width="50px" DataTextField="Filter" DataValueField="FilterID" EnableEmbeddedBaseStylesheet="False" EnableEmbeddedScripts="False" EnableAjaxSkinRendering="False" EnableViewState="False"> | |
| <CollapseAnimation Duration="200" Type="OutQuint" /></telerik:RadComboBox> | |
| <telerik:RadComboBox ID="rcbState" runat="server" Skin="WebBlue" Width="155px" AutoPostBack="True" DataSourceID="sqldsState" DataTextField="State" DataValueField="StateID" OnSelectedIndexChanged="rcbState_SelectedIndexChanged" EnableEmbeddedBaseStylesheet="False" EnableEmbeddedScripts="False" EnableAjaxSkinRendering="False" EnableViewState="False"> | |
| <CollapseAnimation Duration="200" Type="OutQuint" /></telerik:RadComboBox> | |
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" DataSourceID="sqldsSearch" EnableTheming="True" GridLines="Vertical" ShowFooter="True" ShowStatusBar="True" Skin="WebBlue" Width="700px" AutoGenerateColumns="False" ImagesPath="skins\webblue\grid" EnableEmbeddedBaseStylesheet="False" EnableEmbeddedScripts="False" EnableViewState="False"> | |
| <MasterTableView DataSourceID="sqldsSearch" DataKeyNames="CompanyID" EnableColumnsViewState="False" EnableViewState="False"> | |
| <RowIndicatorColumn Visible="False"> | |
| <HeaderStyle Width="20px" /> | |
| </RowIndicatorColumn> | |
| <ExpandCollapseColumn Resizable="False" Visible="False"> | |
| <HeaderStyle Width="20px" /> | |
| </ExpandCollapseColumn> | |
| <EditFormSettings> | |
| <PopUpSettings ScrollBars="None" /> | |
| <EditColumn CancelImageUrl="../Skins/WebBlue/Grid/Cancel.gif" EditImageUrl="../Skins/WebBlue/Grid/Edit.gif" FilterImageUrl="../Skins/WebBlue/Grid/Filter.gif" InsertImageUrl="../Skins/WebBlue/Grid/Insert.gif" SortAscImageUrl="../Skins/WebBlue/Grid/SortAsc.gif" SortDescImageUrl="../Skins/WebBlue/Grid/SortDesc.gif" UpdateImageUrl="../Skins/WebBlue/Grid/Update.gif"> | |
| </EditColumn> | |
| </EditFormSettings> | |
| <Columns> | |
| Columns Removed | |
| </Columns> | |
| <PagerStyle Mode="Slider" FirstPageImageUrl="../Skins/WebBlue/Grid/PagingFirst.gif" LastPageImageUrl="../Skins/WebBlue/Grid/PagingLast.gif" NextPageImageUrl="../Skins/WebBlue/Grid/PagingNext.gif" PrevPageImageUrl="../Skins/WebBlue/Grid/PagingPrev.gif" /> | |
| <CommandItemSettings AddNewRecordImageUrl="../Skins/WebBlue/Grid/AddRecord.gif" RefreshImageUrl="../Skins/WebBlue/Grid/Refresh.gif" /> | |
| </MasterTableView> | |
| <ClientSettings> | |
| <Selecting AllowRowSelect="True" /> | |
| </ClientSettings> | |
| <PagerStyle FirstPageImageUrl="../Skins/WebBlue/Grid/PagingFirst.gif" LastPageImageUrl="../Skins/WebBlue/Grid/PagingLast.gif" NextPageImageUrl="../Skins/WebBlue/Grid/PagingNext.gif" PrevPageImageUrl="../Skins/WebBlue/Grid/PagingPrev.gif" /> | |
| </telerik:RadGrid> |
Subset of Code Behind:
| protected void rcbState_SelectedIndexChanged (object o , RadComboBoxSelectedIndexChangedEventArgs e) { |
| if ( rcbState.SelectedValue != "" && rcbStateFltr.SelectedValue == "" ) { rcbStateFltr.SelectedValue = "1"; } |
| } |
| protected void ddlStage_SelectedIndexChanged (object sender , EventArgs e) { |
| if ( ddlStage.SelectedValue != "" && ddlStageFltr.SelectedValue == "0" ) { ddlStageFltr.SelectedValue = "1"; } |
| } |