简体   繁体   English

asp.net vb-引导表行上的onclick事件未触发代码隐藏功能

[英]asp.net vb - onclick event on bootstrap table row not triggering code-behind function

I have a function that create bootstrap table on the fly using string builder. 我有一个使用字符串生成器动态创建引导表的函数。 And now I want to add onclick event that trigger a code-behind function. 现在,我想添加触发代码隐藏功能的onclick事件。 I already add the onclick event on the TR but when I clicked it, nothing happens. 我已经在TR上添加了onclick事件,但是当我单击它时,什么也没有发生。 here's the complete code : 这是完整的代码:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

   Dim sContent  As New StringBuilder
   Dim sParam as new string = Request.Querystring("p")

   sContent.AppendLine("<table class='table table-hover table-striped table-condensed table-responsive table-bordered'>")
   sContent.AppendLine("<tr style='cursor: pointer;' onclick='viewDetail('" & sParam & "')>")
   sContent.AppendLine("<td style='width:10%;text-align:center'>" & startTime & "</td>")
   sContent.AppendLine("<td style='width:10%;text-align:center'>" & matchStatus & "</td>")
   sContent.AppendLine("<td style='width:30%;text-align:right'>" & sHomeName & "</td>")
   sContent.AppendLine("<td style='width:5%;text-align:center;font-weight:bold'>" & sResultFT & "</td>")
   sContent.AppendLine("<td style='width:30%;text-align:left'>" & sAwayName & "</td>")
   sContent.AppendLine("<td style='width:5%;text-align:center'>" & sResultHT & "</td>")
   sContent.AppendLine("<td style='width:10%'></td>")
   sContent.AppendLine("</tr>")
   sContent.AppendLine("</table>")

   Response.Write(sContent.ToString)
End Sub



Protected Sub viewDetail(ByVal sPar as String)

   '====Here's the code===    

End Sub

I add the onclick='viewDetail' on the TR section of the table, but it didn't trigger the viewDetail. 我在表的TR部分上添加了onclick ='viewDetail' ,但它没有触发viewDetail。 Did I missed something ? 我错过了什么吗? Thanks. 谢谢。

Function viewDetail is a server function. 函数viewDetail是服务器功能。 But event onclick in tr is a client function. 但是tr中的事件onclick是客户端功能。

You can call by ajax for this case. 在这种情况下,您可以通过ajax进行调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM