Inserting multiple checkbox values

Hi EE,

I am trying to figure out how to insert the values from the checked checkbox in an asp.net 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

e.g.

Organ/Space -Site#4

THANK YOU
asp.net page snippet

<td>
            <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>
        <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)" />
            &nbsp;</td>

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

LVL 9
TonyRebaAsked:
Who is Participating?
 
Kiran SonawaneConnect With a Mentor Project LeadCommented:
msdn.microsoft.com/en-us/library/yy6y35y8.aspx
0
 
TonyRebaAuthor Commented:
I dont think the problem is the parameter, but a way to concatenate texfield and checkbox into a parameter.
0
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.