表行onclick事件运行codebehind [英] Table row onclick event that runs codebehind
本文介绍了表行onclick事件运行codebehind的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我继承已设计不当的HTML ASP.NET项目;在一节中,标签与标签包装,以便单击行查看信息功能。在code是:
I've inherited an ASP.NET project that has poorly designed HTML; in one section, the tags are wrapped with an tag to allow for "click the row to view the information" functionality. The code is:
<asp:LinkButton ID="ViewArticle" runat="server" CommandName="Navigate" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "id") %>' >
<tr runat="server" class="list_item">
<td>some data</td>
<td>some data</td>
<td>some data</td>
</tr>
</asp:LinkButton>
我想要做的是这样的:
I'd like to do something like:
<tr runat="server" class="list_item" onclick="doRowPostbackFunction('<%# DataBinder.Eval(Container.DataItem, "id") %>');">
<td>some data</td>
<td>some data</td>
<td>some data</td>
</tr>
我如何去绑一个JavaScript的onclick事件到codebehind?
How do I go about tying a JavaScript "onclick" event to the codebehind?
推荐答案
您可以简单地使用
__doPostBack(eventName, eventArgs);
下面eventName的为code-背后的事件处理程序
Here eventName is code-behind event handler
这篇关于表行onclick事件运行codebehind的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文