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

onkeyup event handler for radtextbox

3 Answers 271 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 05 Feb 2009, 07:43 PM
I have a page with a search textbox and a grid.
As the user types into the textbox i want to display the results in the grid based on the value in the textbox.

I have hooked up the onkeyup event for the textbox to do a postback.

My code is:

aspx:

<

script>

function

movetoend()

 

{

 

var range = document.selection.createRange();

 

range.moveStart(

"textedit");

 

range.select();

}

 

 

</script>

 


 

<telerik:RadTextBox ID="RadTextBoxName" runat="server" TabIndex="1" onfocus="movetoend()"

 

 

OnTextChanged="RadTextBoxName_OnTextChanged">

 

 

</telerik:RadTextBox>

aspx.cs code:

 

protected

void Page_Load(object sender, EventArgs e)

 

{

 

if (!Page.IsPostBack)

 

 

{

 

RadTextBoxName.Attributes.Add(

"onkeyup", "setTimeout('__doPostBack(\\'" + RadTextBoxName.ClientID.Replace("_", "$") + "\\',\\'\\')', 0);");
}

 

 

}

 

 

 

protected

void RadTextBoxName_OnTextChanged(object sender, EventArgs args)

 

{

soNameSearch(RadTextBoxName.Text);

RadTextBoxName.Focus();

}

 


The problem is with the postback there is a page flash each time the grid reloads.
How can i avoid the page flash?

Can you guide me towards the right approach to achieve the desired functionality?

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 09 Feb 2009, 03:06 PM
Hello,

One possible option in this case would be to use the Ajax manager to both ajaxify the grid control, and make an ajax callback to the server as needed, from the client side api of the control.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
newbie
Top achievements
Rank 1
answered on 09 Feb 2009, 06:07 PM
I am sorry but can you show that to me with the help of an example.
0
Yavor
Telerik team
answered on 16 Feb 2009, 07:48 AM
Hello,

Additional information on the keyPress handler can be found in the following topic. How to make a callback to the server, you can see in the following article. I hope this information helps.

All the best,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
newbie
Top achievements
Rank 1
Answers by
Yavor
Telerik team
newbie
Top achievements
Rank 1
Share this question
or