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
7 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Devendra KumarPosted Jun 17, 2016, 5:24 AM
Vinay Singhsir
Devendra KumarPosted Jun 17, 2016, 3:13 AM
Vinay SinghPosted Jun 17, 2016, 3:07 AM
Devendra KumarPosted Jun 17, 2016, 2:59 AM
Vinay SinghPosted Jun 17, 2016, 2:57 AM
Devendra KumarPosted Jun 17, 2016, 2:54 AM
Input string was not in a correct format.
Vinay SinghPosted Jun 17, 2016, 2:30 AM
<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);
}
}
}