Well, if you don't want to do it using Ajax or any other way and just want a normal ASP.NET postback to happen, here is how you do it (without using any other libraries):(好吧,如果您不想使用Ajax或任何其他方式来实现它,并且只是想要发生正常的ASP.NET回发,那么您可以使用以下方法(不使用任何其他库):)
It is a little tricky though... :)(这有点棘手但是...... :))
i.(一世。) In your code file (assuming you are using C# and .NET 2.0 or later) add the following Interface to your Page class to make it look like(在您的代码文件中(假设您使用的是C#和.NET 2.0或更高版本)将以下接口添加到您的Page类中,使其看起来像)
public partial class Default : System.Web.UI.Page, IPostBackEventHandler{}
ii.(II。) This should add (using Tab - Tab ) this function to your code file:(这应该添加(使用Tab - Tab )此函数到您的代码文件:)
public void RaisePostBackEvent(string eventArgument) { }
iii.(III。) In your onclick event in JavaScript, write the following code:(在JavaScript中的onclick事件中,编写以下代码:)
var pageId = '<%= Page.ClientID %>';
__doPostBack(pageId, argumentString);
This will call the 'RaisePostBackEvent' method in your code file with the 'eventArgument' as the 'argumentString' you passed from the JavaScript.(这将在您的代码文件中调用'RaisePostBackEvent'方法,并将'eventArgument'作为您从JavaScript传递的'argumentString'。) Now, you can call any other event you like.(现在,您可以调用您喜欢的任何其他活动。)
PS: That is 'underscore-underscore-doPostBack' ... And, there should be no space in that sequence... Somehow the WMD does not allow me to write to underscores followed by a character!(PS:那是'下划线 - 下划线-doPostBack'......并且,该序列中应该没有空格......不知何故,WMD不允许我写入下划线后跟一个角色!) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…