[英]run method using window.location with asp.net web forms
是否可以为超链接设置服务器端单击处理程序?
It sounds like you're after ASP.net Web Methods, there's an example here . 这听起来像你ASP.net Web方法后,有一个例子在这里 。
Basically, you decorate a method in your code-behind with the System.Web.Script.Services.ScriptMethod
and System.Web.Script.Services.WebMethod
attributes, which means that you can then call the method from javascript. 基本上,您可以使用
System.Web.Script.Services.ScriptMethod
和System.Web.Script.Services.WebMethod
属性在代码后方装饰一个方法,这意味着您可以从javascript中调用该方法。
Consider converting your hyperlink, perhaps it's an <a>
tag, to a ASP.NET server side control: LinkButton . 考虑将您的超链接(可能是
<a>
标记)转换为ASP.NET服务器端控件: LinkButton 。
<asp:LinkButton runat="server" id="foo" OnClick="LinkButton_Click"
Text="Do Some Stuff Server Side, and Expect a Redirect Somewhere" />
It's not clear from the question what you'd like to do server side. 从这个问题尚不清楚您想在服务器端做什么。 From here, you can call custom code and basically do anything once it's posted back.
从这里,您可以调用自定义代码,并在将其回发后基本上可以执行任何操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.