Generate a server-side event fired by the client using _invoke()

Dear Reader,

Situation
I have a textbox control where a user can fill in characters (Artist). During typing characters the gridview will be
filtered. The textbox has a OnTextChanged event that gets fired when the control loses focus and the text has
been changed, but alll I want is that an event gets fired when the user enters characters (OnKeyDown event) which
I tried to solve using Ajax.

Not yet the whole solution...
I thought I found a solution using the function _invoke from JavaScript. This function calls a function on the server
and returns a result. Now, I can filter the DataView bounded to the gridview I want to filter but I can't figure out why
the gridview is not updated/filtered! Here's the server function that's called using the _invoke function. When I call
this function on the server side in the Page_Load() function for example, it works! But, using _invoke() it doesn't...
How can I solve this problem???


[

ExtenderControlMethod]
public string FilterGridView(string filterText)
{


string filterArtist = "[Artist] Like '*" + filterText + "*'";
DataView dataView = (DataView)this._gridView.DataSource;
dataView.RowFilter = filterArtist;
this._gridView.DataBind();

return filterArtist;

}

Thank you in advance!

Yours sincerely,

Johan Machielse
Ordina SI&D - Development Centre Microsoft

0
Johan
3/6/2007 2:47:56 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

2 Replies
741 Views

Similar Articles

[PageSpeed] 14
Get it on Google Play
Get it on Apple App Store

Hi,

 The grid will be updated only when the Html source code for grid will be refreshed after your server call.

If you are using AJAX, you should try using Update panel which is either conditioned to your server invoke or an always updating one.


Thanks and regards
Pandey, Manish Kumar
"Good judgment comes from experience... and a lot of that comes from bad judgment!" -- Will Rogers
0
ManishPandey
3/6/2007 4:11:32 PM

Thank you for your answer.

 I adjusted my example as following:

The ExtenderControlMethod call a delegate which calls the MyHandler function defined in my "Page" class. I set the text in my
textbox and update the panel containing this textbox: no update takes place...I also did another test: I tried to call Response.Redirect("")
ander Server.Transfer(""), these functions also fail: IE returns an error (ApplicationException) that it's inpossible to call these functions during a callback!

public

void MyHandler()
{
myTextBox.Text = "Callback text";
myUpdatePanel.Update();
}

Any ideas?

Thank you in advance!

Johan Machielse
Ordina SI&D - Development Center Microsoft

0
Johan
3/7/2007 7:42:58 AM
Reply: