【发布时间】:2010-06-08 09:55:07
【问题描述】:
我有一个大型应用程序,我将为它启用快捷键。我会找到 2 个为我执行此操作的 JQuery 插件 (demo plug-in 1 - Demo plug-in 2)。你可以找到他们两个in this post in StackOverFlow
我的应用程序已完成,我将为其添加一些功能,因此我不想再次编写代码。
所以快捷键只是捕捉一个组合键,我想知道如何调用快捷键应该触发的服务器方法?
那么如何通过调用我之前编写的方法来使用这些插件中的任何一个呢? 实际上如何使用 Jquery 触发服务器方法?
你也可以找到一篇好文章here, by Dave Ward
更新:这里是场景。当用户按 CTRL+Del 时,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();
}
其他情况相同。如何为这类代码启用快捷方式(使用 session 、 NHibernate 等)
【问题讨论】:
-
你能发布一些服务器端代码的例子吗?
-
@Mark,我会更新我的问题,看看代码示例
-
您找到答案了吗?如果是,请在此处发布 :) (感谢您提供的 Jquery DatePicker 插件 :) 我正在放弃您的网站帖子 :))
标签: .net asp.net jquery performance plugins