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

How to disable AutoPostBack of the RadComboBox through javascript when an item is selected

3 Answers 583 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Emilio
Top achievements
Rank 1
Emilio asked on 02 Dec 2010, 10:09 PM
How to disable AutoPostBack RadComboBox with filter, when an item is selected?
For various reasons can't use AutoPostBack = false.
It has to be through javascript.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Dec 2010, 08:08 AM
Hello Emilo,


I assume, you need a post-back on some event but not when changing the selection in combo and that's why you are setting the AutoPostBack to True.

You can achieve the same functionality with AutoPostBack to false and invoking the postback using built-in javascript method "__doPostBack" method from the desired event (here its OnClientTextChange) and override the RaisePostBackEvent. Perform your code in RaisePostBackEvent function on sever side.

Find the sample code, which post-backs for textchange and not when changing item;

aspx:
<telerik:RadComboBox ID="dropDownListCategory" MarkFirstMatch="True" EmptyMessage="<--Select One-->" AllowCustomText="true" runat="server" AutoPostBack="false" OnClientTextChange="OnClientTextChange" >
</telerik:RadComboBox>

JavaScript:
function OnClientTextChange(sender, args)
  {
       __doPostBack('RadComboBox1', '');
   }

CodeBehind:
protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument)
   {
       base.RaisePostBackEvent(source, eventArgument);
 
       if (source == dropDownListCategory)
       {
           Response.Write("event fired"); // Your code goes here
       }
   }

Thanks,
Princy.
0
Emilio
Top achievements
Rank 1
answered on 03 Dec 2010, 12:52 PM
Hello Princy! Thanks fo reply.

I solved the problem.
It had nothing to do with postback.

Best regards.
0
Rajkumar Subramaniyam
Top achievements
Rank 1
answered on 14 Jan 2011, 06:28 PM
Hi Emillio,

can you share the solution to us? I am also looking for that.
I don't want to submit the when selectedindex changes for some criteria.

what you did to stop the postback??
Thanks
-Raj
Tags
ComboBox
Asked by
Emilio
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Emilio
Top achievements
Rank 1
Rajkumar Subramaniyam
Top achievements
Rank 1
Share this question
or