I have a checkbox list in a grid view edit popup with yes and no choices. I am attempting to populate the checkboxlist with data from the database in the form of "Yes" and "No" strings. How can I select Yes or No on the checkbox list so the user can view and edit the data?
I am using a checkbox list rather than radio buttons because the user needs to be able to deselect all checkboxes.
ASPX:
<asp:CheckBoxList ID="cblCLECompleted" runat="server" RepeatDirection="Horizontal" cssclass="cbTableRow" AutoPostBack="false" Width="50">
<asp:ListItem Text="Yes" Value="Yes">
</asp:ListItem>
<asp:ListItem Text="No" Value="No">
</asp:ListItem>
</asp:CheckBoxList>
Code Behind:
private void PopulateAttorneyPopup(int rowIndex)
{
GridViewRow row = gvAttorneys.Rows[rowIndex];
txtAttorneyName.Text = row.Cells[1].Text;
txtStartDate.Text = row.Cells[2].Text;
if (row.Cells[3].Text == "Yes")
{
cblCLECompleted.Selected = "Yes";
}
else
{
cblCLECompleted.Selected = "No";
}
txtLast4ofSS.Text = row.Cells[4].Text;
}
Thanks for your time and assistance!
Aucun commentaire:
Enregistrer un commentaire