2
我在ASP.NET中使用AJAX相當新(儘管我對低級別的Javascript AJAX非常熟悉),所以額外的細節將不勝感激。我想在文本框上執行onkeyup事件,並在後面的代碼中調用方法。我已閱讀了有關使用頁面方法和腳本管理器標籤的一些內容,但我無法讓語法正確地使它工作。基本上這裏就是我想要做相當於ASP.NET AJAX的OnKeyUp
myfile.aspx
<asp:TextBox ID="textbox1" runat="server" onkeyup="MyMethod()" />
<asp:Label ID="label1" runat="server" />
myfile.aspx.cs
protected MyMethod()
{
String val = textbox1.Text;
String result = // do some LINQ to SQL stuff and get a some data
label1.Text = result;
}