我在訪問代碼背後的「for circle」中的「table」時遇到問題。 這是我的代碼背後:如何在asp.net中訪問後面的html標籤
protected virtual void showAllBooks()
{
DataSet.View_bookDataTable oView_bookDataTable = new DataSet.View_bookDataTable();
DataSetTableAdapters.View_bookTableAdapter oView_bookTableAdapter = new DataSetTableAdapters.View_bookTableAdapter();
oView_bookTableAdapter.Fill(oView_bookDataTable);
string forTable = "";
int BookCount = oView_bookDataTable.Count;
string StartTable = "<table id='tblDelete'>" +
"<thead>" +
"<tr >" +
"<th data-field='checkbox'> select</th>" +
" <th data-field='id'>row</th>" +
" <th data-field='id'>book code</th>" +
"</tr>" +
"</thead>" +
"<tbody>";
for (int i = 0; i < BookCount i++)
{
DataSet.View_bookRow oViewBookRow = oView_bookDataTable[i];
forTable += "<tr id='tr+"+i+"'>" +
string.Format("<td class='center-align'>{0}</td>" +
"<td class='center-align'>{1}</td>" +
"<td class='right-align'>{2}</td>" ,
"<input type='checkbox' id='filled"+ i +"' runat='Server'/>",
i + 1,
oViewBookRow.bookID)+
"</tr>";
}
string endTable = " </tbody>" +
"</table>";
string Finally = string.Format("{0}{1}{2}", StartTable, forTable, endTable);
lblBooks.Text = Finally;
}
現在我不知道該怎麼用ID來訪問這些標籤或等來使用,例如:哪些行復選框選中要插入?
有人能幫助我嗎? –
你能夠在頁面上顯示該表嗎?或者你正在尋找如何添加此表在asp.net頁面上? – MMK