我有一個很大的應用程序,我打算爲它啓用快捷鍵。我會找到2個適用於我的JQuery插件(demo plug-in 1 - Demo plug-in 2)。你可以找到他們兩個in this post in StackOverFlow如何使用jQuery觸發服務器端方法
我的應用程序是一個完整的,我想增加一些功能,所以我不想再towrite代碼。
所以作爲一個快捷方式只是捕捉一個關鍵組合,我不知道如何調用快捷鍵應該觸發的服務器方法?
那麼如何通過調用我之前編寫的方法來使用這些插件中的任何一個? 其實如何使用jquery引發服務器方法?
您還可以找到一個很好的文章here, by Dave Ward
更新:這裏的情景。當用戶按下CTRL +德爾GridView1_OnDeleteCommand所以我有這個
protected void grdDocumentRows_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
try
{
DeleteRow(grdDocumentRows.DataKeys[e.Item.ItemIndex].ToString());
clearControls();
cmdSaveTrans.Text = Hajloo.Portal.Common.Constants.Accounting.Documents.InsertClickText;
btnDelete.Visible = false;
grdDocumentRows.EditItemIndex = -1;
BindGrid();
}
catch (Exception ex)
{
Page.AddMessage(GetLocalResourceObject("AProblemAccuredTryAgain").ToString(), MessageControl.TypeEnum.Error);
}
}
private void BindGrid()
{
RefreshPage();
grdDocumentRows.DataSource = ((DataSet)Session[Hajloo.Portal.Common.Constants.Accounting.Session.AccDocument]).Tables[AccDocument.TRANSACTIONS_TABLE];
grdDocumentRows.DataBind();
}
private void RefreshPage()
{
Creditors = (decimal)((AccDocument)Session[Hajloo.Portal.Common.Constants.Accounting.Session.AccDocument]).Tables[AccDocument.ACCDOCUMENT_TABLE].Rows[0][AccDocument.ACCDOCUMENT_CREDITORS_SUM_FIELD];
Debtors = (decimal)((AccDocument)Session[Hajloo.Portal.Common.Constants.Accounting.Session.AccDocument]).Tables[AccDocument.ACCDOCUMENT_TABLE].Rows[0][AccDocument.ACCDOCUMENT_DEBTORS_SUM_FIELD];
if ((Creditors - Debtors) != 0)
labBalance.InnerText = GetLocalResourceObject("Differentiate").ToString() + "" + (Creditors - Debtors).ToString(Hajloo.Portal.Common.Constants.Common.Documents.CF) + "";
else
labBalance.InnerText = GetLocalResourceObject("Balance").ToString();
lblSumDebit.Text = Debtors.ToString(Hajloo.Portal.Common.Constants.Common.Documents.CF);
lblSumCredit.Text = Creditors.ToString(Hajloo.Portal.Common.Constants.Common.Documents.CF);
if (grdDocumentRows.EditItemIndex == -1)
clearControls();
}
釷等情況都是一樣的。如何啓用這些代碼的快捷方式(使用會話,NHibernate等)
您可以發佈在服務器端代碼的一些例子嗎? – 2010-06-08 12:33:47
@Mark,我會更新我的問題,查看代碼示例 – 2010-06-08 13:04:56
您是否找到答案?如果是的話請在這裏發佈:)(謝謝你的好jQuery DatePicker插件:)我正在休閒你的網站帖子:)) – Shahin 2010-10-29 06:48:46