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

Multiple selection RadComboBox triggering OnSelectedIndexChanged

3 Answers 478 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 11 Jul 2013, 01:58 PM
I have the following scenario: 

<%-- UF --%>
    <tr>
        <td>
            <label>UF</label>
            <br />
            <telerik:RadComboBox ID="rcbUF" runat="server" CheckBoxes="True" EnableCheckAllItemsCheckBox="True" CausesValidation="false"
                Culture="pt-BR" CssClass="lt-width-10" MaxHeight="250" OnItemChecked="rcbUF_ItemChecked" AutoPostBack="true">
            </telerik:RadComboBox>
        </td>
    </tr>
    <%-- Rodovia --%>
        <tr>
            <td>
                <label>Rodovia</label>
                <br />
                <asp:UpdatePanel runat="server" ID="uppRodovia">
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="rcbUF" />
                    </Triggers>
                    <ContentTemplate>
                        <telerik:RadComboBox ID="rcbRodovia" runat="server" CheckBoxes="True" EnableCheckAllItemsCheckBox="True" Culture="pt-BR" MaxHeight="250" CssClass="lt-width-10" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>


When an item is checked on rcbUF, the following method is called (something like that):

protected void rcbUF_ItemChecked(object sender, RadComboBoxItemEventArgs e)
    {
    if (rcbUF.HasSelectedValue())
    {
        var _listaUF = rcbUF.Items.Where(x => x.Checked).Select(x => x.Value).ToList();
        var _rodovias = Repositorio<Rodovia>.GetAll.Where(x => x.ListaUF.Any(y=>_listaUF.Contains(y.UF.Id))).Select(x => x.Id).ToArray();
         
        if (_listaUF.Count > 0)
        {
            rcbRodovia.Carregar<Rodovia>(x => x.Numero, x => x.Id,
                Constantes.TextoVazioEspaco,
                true,
                x => _rodovias.Contains(x.Id),
                x => x.Numero);
        }
        else
        {
            rcbRodovia.Carregar<Rodovia>(x => x.Numero, x => x.Id,
                Constantes.TextoVazioEspaco,
                true,
                x => x.Numero);
        }
         
        rcbRodovia.Items.Distinct();
        rcbRodovia.Enabled = true;
    }
    }

My problem is that everytime I click on the item instead of the checkbox, it triggers a postback (much on the OnItemSelected way), and I really don't want it to occur.

Later I tried setting the rcbUF OnClientSelectedIndexChanging event to trigger this function:

function OnClientSelectedIndexChanging(sender, args)
{
    args.set_cancel(true);
}

But the event never fires, like it does fire the codebehind event but not the client-side one.

3 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 16 Jul 2013, 01:01 PM
Hello Bruno,

I noticed that you had submitted two identical tickets. I have already answered to your other one (ticketID - 715485), so I would like to ask you to continue our conversation in the other thread, in order to avoid duplication.

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.
0
Ben
Top achievements
Rank 1
answered on 18 Dec 2014, 05:46 PM
I have the same question as Bruno. I wanted/expected ItemRequestTimeout to delay the callback. That isn't what happens.

What was the outcome of the support ticket?
0
Boyan Dimitrov
Telerik team
answered on 23 Dec 2014, 02:56 PM
Hello,

As far as I understand you have subscribed for the RadComboBox ItemChecked server-side event. This event actually performs a post-back instead of call back. The ItemRequestTimeout property is related to the ItemsRequested event handler which is quite different than ItemChecked. The corresponding client-side event that might be canceled is OnClientItemChecking


Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Bruno
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Ben
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or