我正在从代码隐藏中动态创建UI。 UI放置在内容占位符中,其中包含带有其名称的复选框图像。名称来自SQL。
Try
Dim QryCount As String = "query to retrieve the data"
Dim TblCount As DataTable = connection.GetDataTable(QryCount, sqlcon)
Dim count As Integer
count = TblCount.Rows.Count
If count <> 0 Then
For Each RowCount As DataRow In TblCount.Rows
str= RowCount("str_name").ToString()
Hit_count = RowCount("Download_Count").ToString()
TT = RowCount("ToolTip").ToString()
u_id = RowCount("id").ToString()
URLData1 = URLData1 & "<input type='checkbox' runat='server' id='check" & u_id & "'/><label for='check" & u_id & "'> <img src='images.png'/><br><a href='simple.aspx?ID=" & u_id & "'title='" & TT & "' target='_blank'>" & str & "</a><span style='font-size: 8pt; font-family:segoe ui;color: #3399FF;'> [" & Hit_count & "]</span>
下一个
lblCol4.Text = URLData1
并且ui页面包含的代码为
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div>
<asp:Button runat="server" ID="btnsubmit" Text="Submit" />
</div>
<div class="columns">
<asp:Label ID="lblCol4" runat="server" Font-Names="Segoe UI" Font-Size="Small" style="text-align: center"></asp:Label>
</div>
这是一个多选复选框。用户选择并单击提交按钮后,我将尝试读取所选的复选框ID属性,以便可以从SQL检索相应的数据。我是asp.net的新手,请帮助我