由无法编辑的asp.net后面的代码创建的表

问题描述 投票:0回答:1

我有一个问题。在从后面的代码创建的<table>上,asp文本框是否不可编辑?

display = display & "<tr><td><asp:TextBox ID='TextBox1' class='bootstrap-tagsinput form-control' style='background: transparent;' data-role='tagsinput' runat='server'>" & gr2.Rows(k).Cells(0).Text & "</asp:TextBox></td></tr>"

当我运行网页时,我可以看到正在创建的表,但是我无法在其中编辑文本框。

这是我的输出:

enter image description here

但是我确实放了一个bootstrap类,该类会使文本框内的值变为标签框,因此我可以像单击x一样关闭标签来进行编辑。但我无法执行此操作,因为文本框似乎不可编辑

它应该看起来像这样:enter image description here

我希望有人对此有所了解。预先感谢!

asp.net vb.net
1个回答
0
投票
最好将HtmlTable添加为WebControl(或通过后面的代码将现有的HtmlTable处理),然后在内部(在单元格中)将TextBox添加为WebControl。这样,您就可以通过后面的代码完全控制。

但是,如果您想在代码中添加HTML元素作为String源(字面意义,则可以尝试以下操作:

display &= "<tr>" & " <td> " & " <input type='text' id='TextBox1' value='" & gr2.Rows(k).Cells(0).Text & "' class='bootstrap-tagsinput form-control' style='background: transparent;' data-role='tagsinput' />" & " </td>" & "</tr>"

© www.soinside.com 2019 - 2024. All rights reserved.