webforms - How to avoid postback on ItemSelected when using a multiple selection RadComboBox? -


i have 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 item checked on rcbuf, following method called (something 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 everytime click on item instead of checkbox, triggers postback (much on onitemselected way), , don't want occur.

am missing here, or expected behavior there no way around it?

the correct way stop postback is

<telerik:radcombobox id="rd1" runat="server" onclientselectedindexchanging="onclientselectedindexchanging" autopostback="true"> <items> <telerik:radcomboboxitem text="1001" /> <telerik:radcomboboxitem text="2001" /> <telerik:radcomboboxitem text="3001" /> <telerik:radcomboboxitem text="4001" /> <telerik:radcomboboxitem text="5001" /> <telerik:radcomboboxitem text="6001" /> </items> </telerik:radcombobox>         function onclientselectedindexchanging(sender, args)         {           args.set_cancel(true);         } 

thanks


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -