Re-Binding Radlistbox without postback

4 posts, 0 answers
  1. Dwayne Moore
    Dwayne Moore avatar
    3 posts
    Member since:
    Sep 2012

    Posted 01 Apr 2010 Link to this post

    I have a 2 list boxes on a page the master list box is loaded from code behind.   I have a second list box on the page which I want populated dynamically.  I have a sqldatasource which calls an parameterized sql strored procedure to load the data.  The control parameter is tied to a text box on the page.  Each time a item or series of items are selected from my first radio list, it populates the textbox with the item values and that in turn should call the sproc with the values as a parameter to load into the second  list box.  It works in theory J, but I’m having a problem loading my second list box.  I really don’t want to have the form post back, because it’s not very optimized even with the ajax controls that can give the same effect as it not posting back.  Any help would be greatly appreciated.

    Below is an example of the scenario that I have.


    <telerik:RadTextBox ID="txtMerch" runat="server" Visible="true"> </telerik:RadTextBox>


                <telerik:RadListBox ID="RadListBox1" runat="server" Height="200px" Skin="Forest"                            CheckBoxes="true" Width="200px" AutoPostBack="false" OnClientItemChecked="onItemChecked" OnClientItemChecking="onItemChecking" >


                <telerik:RadListBox ID="RadListBox2" runat="server" DataSourceID="SqlDataSource2" 

                  DataKeyField="mykey" DataTextField="Locations"  Height="200px" Skin="Forest" AllowAutomaticUpdates="true" AutoPostBack="false"

                CheckBoxes="true" Width="200px">


                <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:MyConnectstring %>"



                SelectCommand= "[dbo].[RptMgr_GetLocations]"


                ProviderName="<%$ ConnectionStrings:MyConnectstring.ProviderName %>"

                SelectCommandType="StoredProcedure" DataSourceMode="DataReader">


    <asp:ControlParameter ControlID="txtMerch"  Name="merch"

    PropertyName="Text" Type="String"  />

                <asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" Type="Int32" />



  2. Genady Sergeev
    Genady Sergeev avatar
    1600 posts

    Posted 02 Apr 2010 Link to this post

    Hello Dwayne Moore,

    RadListBox does not support client-side binding via WebServices/PageMethods out of the box. This means that you cannot bind it on the client and a postback is required. The same applies to SqlDataSource. It is tightly connected with the ASP.NET postbacks paradigm and you can hardly use it in other scenario.

    A possible way to overcome this issue is enlisted below:

    1) Create WebService that returns the data you need in JSON format.
    2) Parse the JSON on the client
    3) Create RadListBoxItems that utilize the received data
    4) Add the newly created items to the listbox.

    Items can be created on the client the following way:

    var item = new Telerik.Web.UI.RadListBoxItem();
    item.set_text('some text');
    item.set_value('some value');

    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Collin
    Collin avatar
    24 posts
    Member since:
    Feb 2008

    Posted 28 Jun 2011 Link to this post

    I actually did an experiment doing this, here is my code-

    A lot left to be desired, but it works, and is enough to get you going.
  4. Genady Sergeev
    Genady Sergeev avatar
    1600 posts

    Posted 01 Jul 2011 Link to this post

    Hello Collin,

    Thank you for sharing this approach with the community. I've updated your telerik points as token of gratitude for the involvement.

    Best wishes,
    Genady Sergeev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top