我在C#中使用asp.net 3.5。當用戶在txtProductID中輸入ProductID時,我需要執行數據庫查找。我想做javascript是不可能的,因爲這必須是服務器端調用。對Textbox onblur事件做一個數據庫查詢
protected void Page_Load(object sender, EventArgs e)
{
txtProductID.Attributes.Add("onblur", "LookupProduct()");
}
protected void LookupProduct()
{
//Lookup Product information on onBlur event;
}
我得到一個錯誤信息:微軟JScript運行時錯誤: 我在網頁的Page_Load事件寫了這個代碼預期的對象 我怎樣才能解決這個問題?
請注意,這個答案會導致PostBack,而@ durilai不會。 – jrummell 2010-03-11 18:57:59