Inserting multiple checkbox values

Posted on 2011-10-14
Last Modified: 2012-05-12
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

Question by:TonyReba
    LVL 17

    Accepted Solution

    LVL 9

    Author Comment

    I dont think the problem is the parameter, but a way to concatenate texfield and checkbox into a parameter.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now