Inserting multiple checkbox values

Hi EE,

I am trying to figure out how to insert the values from the checked checkbox in an page,

I am using individual checkboxes because in the case the user choose the third one, they need to specify aditional details in a textbox,

How can pass this parameters and concatenate the values to the stored procedure so I can have


Organ/Space -Site#4

THANK YOU page snippet

            <span style="color: #FF0000">*</span> Specific Events<br />
            <asp:CheckBox ID="eventdetailsSSI1" runat="server" 
                Text="Superficial incisional primary (SIP)" />
            <br />
            <asp:CheckBox ID="eventdetailsSSI2" runat="server" 
                Text="Superficial incisional secondary (SIS)" />
            &nbsp; <br />
            <asp:CheckBox ID="eventdetailsSSI3" runat="server" Text="Organ/Space " />
            (specify site):
            <asp:TextBox ID="eventdetailsSSI3Extra" runat="server"></asp:TextBox>
            <br />
        <td colspan="2" style="width: 307px">
            <asp:CheckBox ID="eventdetailsSSI4" runat="server" 
                Text="Deep incisional primary (DIP)" />
            <br />
            <asp:CheckBox ID="eventdetailsSSI5" runat="server" 
                Text="Deep incisional secondary (DIS)" />

Open in new window

code behind code

SqlCommand cmd = new SqlCommand("Insert_SSI", conn);
        cmd.CommandType = CommandType.StoredProcedure;


cmd.Parameters.AddWithValue("@eventdetailsSSI", eventdetailsSSI1.Text);
        cmd.Parameters.AddWithValue("@eventdetailsSS2", eventdetailsSSI1.Text);
        cmd.Parameters.AddWithValue("@eventdetailsSS3", eventdetailsSSI1.Text);
        cmd.Parameters.AddWithValue("@eventdetailsSS3B", eventdetailsSSI3Extra.Text);
        cmd.Parameters.AddWithValue("@eventdetailsSS4", eventdetailsSSI1.Text);


Open in new window

Who is Participating?
Kiran SonawaneConnect With a Mentor Project LeadCommented:
TonyRebaAuthor Commented:
I dont think the problem is the parameter, but a way to concatenate texfield and checkbox into a parameter.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.