This is a migrated thread and some comments may be shown as answers.

[Solved] Search (web user control) using RadGrid, RadCombobox, RadTextBox, RadAjaxManager, RadScriptManager, RadStyleSheetManager, RadFormDecorator, SqlDataSource(s)

11 Answers 416 Views
Grid
This is a migrated thread and some comments may be shown as answers.
donoho
Top achievements
Rank 1
donoho asked on 22 Apr 2008, 12:19 AM
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:
<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"; } 
    } 
 

11 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 25 Apr 2008, 11:21 AM
Hello donoho,

Have you tried enabling the View State of the two RadComboBoxes in question? What happens in this case?

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
donoho
Top achievements
Rank 1
answered on 25 Apr 2008, 07:08 PM
Enabling ViewState had no effect.
0
Erjan Gavalji
Telerik team
answered on 30 Apr 2008, 01:47 PM
Hi donoho,

Is it possible for you to open a formal support ticket and send your application (or its simplified version) to us? To my regret we were not able to get the reason for the problem checking the code you sent us.

Looking forward to your reply,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
donoho
Top achievements
Rank 1
answered on 30 Apr 2008, 05:26 PM
I will submit a formal request within the next few days. 

I have temporarily circumvented this problem by passing all  RadComboBox SelectedValues to session variables (initialized in a Global.asax) and changing the SQLDataSource to use Session Parameters instead of Control Parameters.
0
Simon
Telerik team
answered on 06 May 2008, 08:49 AM
Hi donoho,

The problem with the ViewState of RadComboBox has been resolved. I have attached the latest trial hotfix to this post.

If you need the dev version, please open a formal support ticket and request the hotfix - we will send it to you there.

All the best,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
donoho
Top achievements
Rank 1
answered on 08 May 2008, 02:10 AM
Thank You.

I'm waiting for the go ahead to get the Dev + Sub + Src license.  If this happens in the next week I'll create a Formal Support Request for dev fix as well.
0
Trevor
Top achievements
Rank 1
answered on 14 Jul 2008, 08:19 PM
Hi,

I am having the same problem described in this thread. I am evaluating the product for my boss to make a recommendation. How do I apply the hotfix to my trial installation to fix this problem?

Thank you,
Trevor
0
Trevor
Top achievements
Rank 1
answered on 14 Jul 2008, 09:00 PM
Hi,

Actually as I look at the file datetime stamps, I have a newer version of the controls than the hotfix you link to. How can I fix this issue...the radcombobox does not send the DataValueField of the radcombobox to the stored procedure. My radcombobox is in an EditItemTemplate.

<telerik:GridTemplateColumn HeaderText="IXC" UniqueName="TemplateColumn">

<ItemTemplate>

<%

#DataBinder.Eval(Container.DataItem, "IXC")%>

</ItemTemplate>

<EditItemTemplate>

<telerik:RadComboBox EnableViewState="true" runat="server" ID="RadComboBox2" DataTextField="IXC" DataValueField="IXCID" Height="140px"

DataSourceID="sqlIXC" SelectedValue='<%# Bind("IXCID") %>'>

<CollapseAnimation Duration="200" Type="OutQuint" />

</telerik:RadComboBox>

</EditItemTemplate>

<ItemStyle Width="240px" />

</telerik:GridTemplateColumn>


And then...

<asp:SqlDataSource ID="sqlDev" runat="server" ConnectionString="<%$ ConnectionStrings:SQL-DEVCTIConnectionString %>"

SelectCommand="SELECT DCBalanceID, AgentIXC.IXCID, IXC, MSNAssignment, BRKAssignment, CapTelAssignment &#13;&#10;FROM AgentDCBalance &#13;&#10;INNER JOIN AgentIXC &#13;&#10;ON AgentDCBalance.IXCID = AgentIXC.IXCID "

UpdateCommand="stp_UpdateAgentDCBalance" UpdateCommandType="StoredProcedure">

<UpdateParameters>

<asp:ControlParameter ControlID="RadGrid1" Name="DCBalanceID" PropertyName="SelectedValue" />

<asp:ControlParameter ControlID="RadGrid1" Name="IXCID" PropertyName="SelectedValue" />

<asp:ControlParameter ControlID="RadGrid1" Name="MSNAssignment" PropertyName="SelectedValue"

Type="Decimal" />

<asp:ControlParameter ControlID="RadGrid1" Name="BRKAssignment" PropertyName="SelectedValue"

Type="Decimal" />

<asp:ControlParameter ControlID="RadGrid1" Name="CapTelAssignment" PropertyName="SelectedValue"

Type="Decimal" />

</UpdateParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="sqlIXC" runat="server" ConnectionString="<%$ ConnectionStrings:SQL-DEVCTIConnectionString %>"

SelectCommand="SELECT [IXCID], [IXC] FROM [AgentIXC]"></asp:SqlDataSource>


Thank you for your help.

-Trevor

0
Rosi
Telerik team
answered on 15 Jul 2008, 02:32 PM
Hello Trevor,

In your code the UpdateParameters used for the stored procedure do not point to RadComboBox and to the column name where RadComboBox resides. Could this be the reason of the problem? Also please have a look at our online example - Combo in Grid

Hope this helps.

Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Trevor
Top achievements
Rank 1
answered on 15 Jul 2008, 04:27 PM
Hi,

Thank you for your reply.

In the online example which you refer to, the UpdateParameters also do not point to the RadComboBox and to the column name where RadComboBox resides.

Here is the code from the example:

            <UpdateParameters>
                <asp:Parameter Name="CompanyName" Type="String" />
                <asp:Parameter Name="ContactName" Type="String" />
                <asp:Parameter Name="ContactTitle" Type="String" />
                <asp:Parameter Name="Address" Type="String" />
                <asp:Parameter Name="City" Type="String" />
                <asp:Parameter Name="Region" Type="String" />
                <asp:Parameter Name="PostalCode" Type="String" />
                <asp:Parameter Name="Country" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="Fax" Type="String" />
                <asp:Parameter Name="CustomerID" Type="String" />
            </UpdateParameters>


Can you please explain how to achieve passing the selected DataValueField to the stored procedure?

Thank you.
0
Trevor
Top achievements
Rank 1
answered on 15 Jul 2008, 07:14 PM
Hi,

I realized that the MasterTableView DataKeyNames had IXCID appended to it after I created another SQLDataSource. Once I removed this, it worked fine.

Thanks for your assistance.

Trevor
Tags
Grid
Asked by
donoho
Top achievements
Rank 1
Answers by
Simon
Telerik team
donoho
Top achievements
Rank 1
Erjan Gavalji
Telerik team
Trevor
Top achievements
Rank 1
Rosi
Telerik team
Share this question
or