Call ServerSide OnTextChanged from JavaScript on keypress of Radtextbox

HI,

I have a Telerik RadTextBox and I want to call server side radTxtSearch_OnTextChanged method from javascript onKeyPress event of this TextBox.

ONkeyPress event is called ... but serverside code is not being called.

Also , once the server side code is executed, the value entered in the textbox should be retained.

NOte: I can use ASP.TextBox instead of Telerik.

Please advice....

 
<telerik:RadTextBox ID="radTxtSearch" runat="server" Width="100%" OnTextChanged="radTxtSearch_OnTextChanged" AutoPostBack="true">
                                            <ClientEvents OnKeyPress="OnKeyPress" />
 </telerik:RadTextBox> 

-----
<telerik:RadScriptBlock ID="RadScriptBlock_PN" runat="server">
    <script language="javascript" type="text/javascript">
         function OnKeyPress(sender, eventArgs) {
                      var searchText = document.getElementById('<%= radTxtSearch.ClientID %>');
                        __doPostBack('searchText', 'TextChanged');    // this is not working
         }
    </script>
</telerik:RadScriptBlock>
---------- 
-----Aspx.cs----
protected void radTxtSearch_OnTextChanged(object sender, EventArgs args) 
        {}

Open in new window


Thanks
kishan66Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kishan66Author Commented:
anybody?
0
MlandaTCommented:
Your proposed model is not ideal on a website. In order to execute the TextChanged event, you will have to do a full page postback on each keypress. This will make typing into that RadTextbox a really horrible experience for your users.

What exactly are you trying to achieve? Perhaps we can also give some insight into what might be an alternative approach to accomplish what you want without hurting the user experience.
0
kishan66Author Commented:
basically, i have a RadTextbox & a Radlistbox with values.
i want to filter the Radlistbox values based on the text entered in the RadTextbox (something like google autotext).

List should be filetred on every keychar entered.

Thanks for trying to help.
0
MlandaTCommented:
Have a look at this sample: http://www.telerik.com/support/code-library/filteredlistbox---client-side-radlistbox-filter

You want to keep you filtering as much on the client side as possible.

It's a pity that unlike the RadComboBox, the RadListBox does not have a client side RequestItems method which would pull the items from a web service.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.