how to insert multiple checked value in single column in c#
like i select value like this:
<asp:DropDownCheckBoxes ID="ddsize" runat="server" UseButtons="true" >
asp:DropDownCheckBoxes>
int str =0;
for (int i = 0; i <= ddsize.Items.Count - 1; i++)
{
if (ddsize.Items[i].Selected)
{
if (str ==0)
{
str =int.Parse( ddsize.Items[i].Value);
}
else
{
str +=int.Parse(ddsize.Items[i].Value);
}
}
}
select value 1 and 2 and 3 then
i want insert all id in single column


Vinay SinghRank #604 · 4K reputationPosted Jun 16, 2016, 10:30 PM EDT
<asp:CheckBoxList ID="ddsize" runat="server">
<asp:ListItem Text="Queen" Value="1">asp:ListItem>
<asp:ListItem Text="Twin" Value="2">asp:ListItem>
<asp:ListItem Text="Round" Value="3">asp:ListItem>
<asp:ListItem Text="King" Value="4">asp:ListItem>
asp:CheckBoxList>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
protected void Button1_Click(object sender, EventArgs e)
{
string str = "";
for (int i = 0; i <= ddsize.Items.Count - 1; i++)
{
if (ddsize.Items[i].Selected)
{
str = str + (str == "" ? ddsize.Items[i].Value : "," + ddsize.Items[i].Value);
}
}
}
Vinay SinghRank #604 · 4K reputationPosted Jun 16, 2016, 10:57 PM EDT
Devendra KumarRank #3,132 · 457 reputationPosted Jun 16, 2016, 10:54 PM EDT
Input string was not in a correct format.
Devendra KumarRank #3,132 · 457 reputationPosted Jun 16, 2016, 10:59 PM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 16, 2016, 11:07 PM EDT
Devendra KumarRank #3,132 · 457 reputationPosted Jun 16, 2016, 11:13 PM EDT
Devendra KumarRank #3,132 · 457 reputationPosted Jun 17, 2016, 1:24 AM EDT
Vinay Singhsir