//.aspx code
<asp:CheckBoxList runat="server" RepeatColumns="0" Height="250" Width="150" RepeatDirection="Vertical"
CssClass="btext" ID="chkLstSkill">
</asp:CheckBoxList>
//.cs code
string values = "";
if (chkLstSkill.SelectedValue = = "")
{
//do something if not selected
}
else
{
// We perform a for loop to check if each checkbox is selected then we get the value
foreach (ListItem objItem in chkLstSkill.Items)
{
if (objItem.Selected)
{
values += objItem.Value;
TrainingID = values;
//Use below if u want only one id at a time else dont use it
// values = "";
// TrainingID = ""; //
}
}
<asp:CheckBoxList runat="server" RepeatColumns="0" Height="250" Width="150" RepeatDirection="Vertical"
CssClass="btext" ID="chkLstSkill">
</asp:CheckBoxList>
//.cs code
string values = "";
if (chkLstSkill.SelectedValue = = "")
{
//do something if not selected
}
else
{
// We perform a for loop to check if each checkbox is selected then we get the value
foreach (ListItem objItem in chkLstSkill.Items)
{
if (objItem.Selected)
{
values += objItem.Value;
TrainingID = values;
//Use below if u want only one id at a time else dont use it
// values = "";
// TrainingID = ""; //
}
}
No comments:
Post a Comment