本文介绍了某些Javascript(__ doPostBack,Button.click())未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我已将下面的代码添加到Postback onkeypress。在同一个Debug运行中,有时我能够完美地运行,但大多数情况下它会跳过一两个函数。 protected void gv_RowDataBound( object sender,GridViewRowEventArgs e ) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState == DataControlRowState.Edit)|| (e.Row.RowState ==(DataControlRowState.Edit | DataControlRowState.Alternate))) { e.Row.Attributes.Add( onkeydown, javascript:if(event.keyCode == 13){__ doPostBack(' + gv.UniqueID + ','更新$ + e.Row.RowIndex.ToString()+ '); $('# + Button3.UniqueID + ')。click(); __doPostBack(' + gv.UniqueID + ','编辑$ + (e.Row.RowIndex + 2 )。ToString()+ ');返回false; }); } } } 我正在使用。 Net Framework 3.5和IE11作为浏览器。解决方案 + e.Row.RowIndex.ToString()+ '); ('# + Button3.UniqueID + ')。click(); __ doPostBack(' + gv.UniqueID + ','编辑 + (e.Row.RowIndex + 2 )。ToString()+ ');返回false ;}); } } } 我使用.Net Framework 3.5和IE11作为浏览器。 I have added the code below to Postback onkeypress. On the same Debug run, sometimes I am able to run perfectly but most other times it will skip one or two functions.protected void gv_RowDataBound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))) { e.Row.Attributes.Add("onkeydown", "javascript:if(event.keyCode == 13) {__doPostBack('" + gv.UniqueID + "', 'Update$" + e.Row.RowIndex.ToString() + "'); $('#" + Button3.UniqueID + "').click(); __doPostBack('" + gv.UniqueID + "', 'Edit$" + (e.Row.RowIndex + 2).ToString() + "'); return false; }"); } }}I am using .Net Framework 3.5 and IE11 as browser. 解决方案 " + e.Row.RowIndex.ToString() + "');('#" + Button3.UniqueID + "').click(); __doPostBack('" + gv.UniqueID + "', 'Edit" + (e.Row.RowIndex + 2).ToString() + "'); return false; }"); } }}I am using .Net Framework 3.5 and IE11 as browser. 这篇关于某些Javascript(__ doPostBack,Button.click())未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-26 00:06