Это моя сетка, которая является динамической c. Сохраняет описание клиента для каждого флажка. То есть, если я отмечу флажок для Индивидуального, тогда он сохраняет Y в моей базе данных, иначе N. Так что теперь я просто хочу отметить галочкой флажки, которые сохранены в базе данных Y. Ниже приведен код для моей динамической c сетки:
public string getCustomerStateGrid()
{
string html = ""; int Count = 1;
DataTable dt = getDataTableFromQuery(@"select Id,cuscheckbox,CustomerDescription from CustomerState3");
html = "<h2> Customer State </h2><br/><table class=\"display unbreakable\" id=\"tblCustomerDetail\" style=\"width:100%; border-collapse: collapse;\"><thead>";
#region Header
html += "<tr><th height='40' class=\"Greyheader\" style=\"width:5%\">S.No</th>";
html += "<th height='40' class=\"Greyheader\" style=\"width:30%\">Customer Status</th>";
html += "<th height='40' class=\"Greyheader\" style=\"width:15%\">Customer Description</th>";
//html += "<th class=\"Greyheader\" style=\"width:12%\">Action</th>";
html += "</tr></thead>";
#endregion
#region Body
html += "<tbody>";
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
html += "<tr class=\"GreyBorder\" id='tblCustomerDetail_" + dr["Id"].ToString() + "' pkid=\"" + dr["Id"].ToString() + "\" class=\"DataRow\">";
html += "<td class=\"GreyBorder\" style=\"text-align:center !important;\">" + Count + "</td>";
html += "<td class=\"GreyBorder\"><input id='txtcuscheckbox_" + dr["Id"].ToString() + "' type=\"checkbox\" style=\" text-align: right; width:95;\" value='" + dr["cuscheckbox"].ToString() + "' class=\"mediumTextField Customer Status\" /></td>";
html += "<td class=\"GreyBorder\"><input id='txtCustomerDescription_" + dr["Id"].ToString() + "' type=\"textbox\" style=\" text-align: right; width:95;\" value='" + dr["CustomerDescription"].ToString() + "' class=\"mediumTextField Customer Description\" /></td>";
html += "</tr>";
Count++;
}
}
else
{
html += "<tr class=\"GreyBorder\" ><td style=\"text-align:center !important;\" class=\"GreyBorder\" colspan='6'>No Data.</td></tr>";
html += "</tr>";
}
html += "</tbody>";
#endregion
html += "<tfoot><tr class='GreyBorder'>";
html += "<td class='GreyBorder' colspan='2'></td> ";
html += "</tr></tfoot>";
html += "</table><br/>";
return html.ToString();
}
Я просто хочу настроить эту строку кода
html += "<td class=\"GreyBorder\"><input
id='txtcuscheckbox_" + dr["Id"].ToString() + "'
type=\"checkbox\"
style=\" text-align: right; width:95;\" value='" + d
dr["cuscheckbox"].ToString() + "' class=\"mediumTextField
Customer Status\" /></td>";
, чтобы она отображалась в галочке. Может ли кто-нибудь изменить мой код для достижения этого результата? Есть ли способ, которым мы можем сделать, используя троичный оператор? ![enter image description here](https://i.stack.imgur.com/T3ITZ.png)