0
ASP.net按鈕不適用於iOS8。點擊按鈕會發生,但點擊事件不會觸發。 相同的代碼在其他瀏覽器中正常工作 - Chrome。 從未出現過這種問題,當在iOS7,甚至Safari瀏覽器 - 問題已經拿出更新之後iOS8上iOS8 ASP.net回調事件不起作用
下面是我在我的aspx頁面代碼:
<asp:Button runat="server" ID="btnLogin" Text="Next" OnClientClick="return fnValidateLoginData();" />
下面是我在JS文件已經定義了驗證函數行:
function ValidateImageCount()
{
var action_Nm =$("#ctl00_cphContent_hdn_action_Nm").val() ;
var transmittalKey = $("#ctl00_cphContent_hdn_transmittalKey").val() ;
var cr_type = $("#ctl00_cphContent_hdn_cr_type").val() ;
var imageValues = $("#ctl00_cphContent_hdnImageValue").val();
var webUserID =$("#ctl00_cphContent_hdnWebUserID").val() ;
var validateWebUser =$("#ctl00_cphContent_hdnValidateWebUser").val() ;
var CR_ID = $("#ctl00_cphContent_hdn_cr_ID").val() ;
var inputData ="{imageValues: \"" + imageValues + "\", webUserID:\"" + webUserID + "\",validateWebUser: \"" + validateWebUser + "\",action_Nm: \"" + action_Nm + "\", cr_type: \"" + cr_type + "\", transmittalKey: \"" + transmittalKey + "\", CR_ID: \"" + CR_ID + "\"}";
fnCallServerMethod(inputData,"");
return false;
}
下面是回調事件:
protected void Page_Load(object sender, EventArgs e)
{
ac = new AuthenticationController();
HttpContext hc = HttpContext.Current;
#region ICallBack Reference
// get reference of call back method named JSCallback
string cbref = Page.ClientScript.GetCallbackEventReference(this,
"arg", "fnGetOutputFromServer", "context");
// Generate JS method trigger callback
string cbScr = string.Format("function fnCallServerMethod(arg," +
" context) {{ {0}; }} ", cbref);
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"fnCallServerMethod", cbScr, true);
}
非常感謝!這有效並解決了問題! :) – 2014-09-29 14:00:12