[英]Dynamic anchor tag onclick is not calling server function
I am trying to create anchor tags whose onClick fire a server side function. 我正在尝试创建锚标记,其onClick会触发服务器端功能。 But this is not working.
但这是行不通的。 Also I want to pass some parameters whose value takes from db.
我也想传递一些参数,其值取自db。
html.Append("<tr id='" + evidenceID + "'>" +
"<td><a id='" + titleId + "' href='#' runat='server' OnClick='StreamVideoCall('" + parameters + "')'>" + myDeserializedObjList[item].attributes.title + "</a></td>" +
"<td>" + myDeserializedObjList[item].attributes.recordedOn + "</td>"+
"<td id='t" + item + "'>" + owner + "</td></tr>");
I tried asp:Hyperlink. 我尝试了asp:Hyperlink。 But doesn't work.
但是不起作用。 Can anyone please help me.
谁能帮帮我吗。
If you are creating this control list that is table
from your server code, then better use the Table Control
and add each row and column based on your database table 如果要创建服务器代码
table
该控件列表,则最好使用“ Table Control
并根据数据库表添加每一行和每一列
In the specified table cell you have to create HtmlAnchor
or HyperLink
control as you wish and add it to table cell
control collection. 在指定的表单元格中,您必须根据需要创建
HtmlAnchor
或HyperLink
控件,并将其添加到table cell
控件集合中。
then add this table control created in server code to any div that is set runat = server
in html source 然后将此在服务器代码中创建的表控件添加到在HTML源代码中设置
runat = server
任何div中
EDIT 编辑
You may refer this link to see how dynamically add table row and cell to a table control. 您可以参考此链接以了解如何动态地向表控件添加表行和单元格。
event handler to the dynamic anchor control can added using anch.OnClick += eventhandler;
可以使用
anch.OnClick += eventhandler;
向动态锚控件添加事件处理程序anch.OnClick += eventhandler;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.