I am trying make dynamic table from database . Table Build dynamically by inserting html table code inserting place holder to get result like Grideview.
but one insert asp control button..
Problem is in that button . that doesn't appear on page . other full table is display well
html.Append(" ");
public StringBuilder DataTableBuilder(DataSet ds)
{
try
{
//Building an HTML string.
StringBuilder html = new StringBuilder();
//Table start.
html.Append("<div class='row container' style='font-size:large;'> " +
" <div class='col-md-12 col-sm-12'> " +
" <div class='card card-box'> " +
" <div class='card-head' > " +
" <header>New Student List</header> " +
" <div class='tools'> " +
" <a class='fa fa-repeat btn-color box-refresh' href='javascript:;'></a> " +
" <a class='t-collapse btn-color fa fa-chevron-down' href='javascript:;'></a> " +
" <a class='t-close btn-color fa fa-times' href='javascript:;'></a> " +
" </div> " +
" </div> " +
" <div class='card-body '> " +
" <div class='table-wrap' > " +
" <div class='table-responsive'> " +
" <table class='table display product-overview mb-30' id='support_table' runat='server'> " +
" <thead >");
DataTable dt = ds.Tables[0];
//Building the Header row.
html.Append("<tr>");
foreach (DataColumn column in dt.Columns)
{
html.Append("<th style='text-align:center'>");
html.Append(column.ColumnName);
html.Append("</th>");
}
html.Append("<th style='text-align:center'>Edit</th> </tr> </thead> <tbody style='text-align:right'> ");
//Building the Data rows.
foreach (DataRow row in dt.Rows)
{
html.Append("<tr>");
foreach (DataColumn column in dt.Columns)
{
html.Append("<td>");
html.Append(row[column.ColumnName]);
html.Append("</td>");
}
html.Append(" <td> <asp:CheckBox ID='Selected" + row["ID"].ToString() + "' runat='server' AutoPostBack='true' OnCheckedChanged='Load_data' /> </td></tr>");
// "<asp:button id='id" + row["ID"].ToString() + "' data-toggle='tooltip' runat='server' AutoPostBack='true' OnClick='Load_data' Text='Edit' / > ============ html.Append(" <td><a onclick='Load_data("+ row["ID"].ToString()+ ")' data-toggle='tooltip' runat='server' AutoPostBack='true' title='Edit'><i class='fa fa-check'></i></a></td></tr>");
}
html.Append("</tbody> " +
" </table> " +
" </div> " +
" </div> " +
" </div> " +
" </div> " +
" </div> " +
" </div>");
return html;
}
catch
{
return null;
}
}
"<input type=\"checkbox\"... />