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

SelectedIndexChanged Postback without refreshing

1 Answer 407 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Newbiew
Top achievements
Rank 1
Newbiew asked on 10 Dec 2013, 08:38 PM
I'm going to try and make this as short as possible another developer created some controls, I am attempting to use a checkboxlist that when an item is selected to have the data entered in a Listbox.  With using a postback the page refreshes every time I select an item, so I started searching on how to postback without refreshing the page. The closest that I have gotten is with the attached code; the issue with the current code is the information is entered into the box but it is as though some event is waiting to happen after I select an item because I am getting the spinning symbol when I move around various spots on the page and it prevents me from clicking on a seperate button while this is occurring.  If anyone can provide any assistance please help.  I have attempted to use the below forums as reference.

http://www.telerik.com/community/forums/community-forums/web-2/radgrid-refresh-without-postback.aspx

http://www.telerik.com/community/forums/aspnet-ajax/window/radwindow-and-radajaxpanel.aspx
 
in ascx
<telerik:RadComboBox ID="rcb_County" runat="server" OnDataBound="rcb_County_DataBound">
                                <ItemTemplate>
                                    <asp:CheckBoxList ID="cbl_County" runat="server" autopostback="True" OnSelectedIndexChanged="CheckBoxList_SelectedIndexChanged">
                                    </asp:CheckBoxList>
                                </ItemTemplate>
                            </telerik:RadComboBox>
                            <asp:CustomValidator ID="cvCounty" runat="server" ClientValidationFunction="validateCounty"
                                CssClass="validation" ErrorMessage="* Required"></asp:CustomValidator>
in ascx
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ClientEvents></ClientEvents>
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rcb_County">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rcb_County" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
Code Behind
protected void CheckBoxList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox.Items.Clear();
            System.Threading.Thread.Sleep(1000);
            CheckBoxList cbl_County = rcb_County.Items[0].FindControl("cbl_County") as CheckBoxList;
            foreach (ListItem val in cbl_County.Items)
            {
                if (val.Selected)
                {
                    ListBox.Items.Add(val.Text);
                }
            }
        }

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 13 Dec 2013, 01:48 PM
Hello,

First of all, I would like to ask you to elaborate on the implementation of the RadComboBox. The RadComboBox has its own build-in feature for CheckBoxes, by simply enabling its CheckBoxes property. Did you purposely implemented the approach using a CheckBoxList in its ItemTemplate? However, if the CheckBoxes feature of the RadComboBox is enabled, you could easily achieve the desired functionality, by handling the OnTextChanged event of the control. The event would be fired, once the client selects the desired checkboxes from the RadComboBox and the control is blurred. At the OnTextChanged event handler, you could access the checked items and populate the other control. I am sending you a sample page, demonstrating the implementation of the above suggestion.

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
ComboBox
Asked by
Newbiew
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or