Hi All,
I want to cancel the post back when calling "OnClientIndexChanged" event.
I tried to set AutoPostBack="false", but the page still posts back.
I tried to cann eventArgs.set_cancel(true) for "OnClientIndexChanging", but then the client selection is not shown.
How can I solve this problem?
I just don't want the page to posts back...
Thanks for your help..
I want to cancel the post back when calling "OnClientIndexChanged" event.
I tried to set AutoPostBack="false", but the page still posts back.
I tried to cann eventArgs.set_cancel(true) for "OnClientIndexChanging", but then the client selection is not shown.
How can I solve this problem?
I just don't want the page to posts back...
Thanks for your help..
4 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 26 Mar 2012, 08:22 AM
Hello,
I tried your scenario and and it works without postback. RadComboBox postbacks only if its AutoPostBack property is set to true. Following is the sample code.
ASPX:
JS:
Please provide more information if it doesn't helps.
Thanks,
Princy.
I tried your scenario and and it works without postback. RadComboBox postbacks only if its AutoPostBack property is set to true. Following is the sample code.
ASPX:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
OnClientSelectedIndexChanged
=
"OnClientSelectedIndexChanged"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"RadComboBoxItem1"
/>
<
telerik:RadComboBoxItem
Text
=
"RadComboBoxItem2"
/>
<
telerik:RadComboBoxItem
Text
=
"RadComboBoxItem3"
/>
<
telerik:RadComboBoxItem
Text
=
"RadComboBoxItem4"
/>
<
telerik:RadComboBoxItem
Text
=
"RadComboBoxItem5"
/>
<
telerik:RadComboBoxItem
Text
=
"RadComboBoxItem6"
/>
</
Items
>
</
telerik:RadComboBox
>
<script type=
"text/javascript"
>
function
OnClientSelectedIndexChanged(sender, args)
{
alert(sender.get_selectedItem().get_text());
}
</script>
Thanks,
Princy.
0

THANGARAI
Top achievements
Rank 1
answered on 19 May 2014, 12:50 PM
Hi Princy,
in that above code, I added like
args.set_cancel(true);
but its not stop postbacking.
Please provide the solution to stop postback in OnClientIndexChanged event.
thank you.
in that above code, I added like
args.set_cancel(true);
but its not stop postbacking.
Please provide the solution to stop postback in OnClientIndexChanged event.
thank you.
0

Princy
Top achievements
Rank 2
answered on 20 May 2014, 06:05 AM
Hi THANGARAI,
The OnClientSelectedIndexChanged client-side event occurs immediately after the selected item has changed. It is not possible to cancel this event. The OnClientSelectedIndexChanging client-side event occurs when the selected item is being changed. This event is fired before the combobox selection has changed to a new item. We can cancel this event to prevent the selection from changing. In order to achieve your scenario you can use OnClientSelectedIndexChanging event.
Thanks,
Princy.
The OnClientSelectedIndexChanged client-side event occurs immediately after the selected item has changed. It is not possible to cancel this event. The OnClientSelectedIndexChanging client-side event occurs when the selected item is being changed. This event is fired before the combobox selection has changed to a new item. We can cancel this event to prevent the selection from changing. In order to achieve your scenario you can use OnClientSelectedIndexChanging event.
Thanks,
Princy.
0

THANGARAI
Top achievements
Rank 1
answered on 20 May 2014, 06:59 AM
Thank you Princy.