点击后如何识别page_load中的Html链接(锚点)?
我的 aspx 页面中有一些锚点。
我需要在点击后在 page_load 中确定它们(可以运行 page_load)。
如您所知,这些锚点不是常规的 ASP.NET 控件,当您单击它们时 Page.IsPostBack
始终为 false。
由于某些原因我无法使用链接按钮。
那么,我如何确定点击后 page_load 中的那些锚点?
提前致谢
i have some anchors in my aspx page.
i need to determine them (couse to run page_load) in page_load after click.
as you know those anchors are not regular asp.net controls and when you click them Page.IsPostBack
is always false.
i can not use linkbuttons for some reasons.
so, how can i determine those anchors in page_load after click?
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我唯一的想法是使用 url 中的参数并使用它们来识别单击了哪个超链接。
在代码后面
但是您不能使用
LinkButtons
或其他一些控件的原因是什么?这种方法在 ASP.NET 中会更方便。Well, my only idea is tu use parameters in url and use them to identify which hyperlink was clicked.
And in code behind
But what's the reason you cannot use
LinkButtons
or some other controls? This approach would be more convenient in ASP.NET.一种更优雅的方法是在 javascript 中使用 __doPostBack 函数(它已经存在于每个 asp.net 页面中)并设置适当的
事件目标和事件参数。 这就是 ASP.NET 控件回发到服务器的方式
例如,
。在服务器端,您可以按如下方式处理单击事件
A more elegant way would be to use __doPostBack function(It's already there in every asp.net page) in javascript and set appropiate
event targent and event argument. This is how asp.net controls posts back to server
for example.
On the server Side, you could handle the click event as following