[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

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

0
TonyReba
Asked:
TonyReba
1 Solution
 
sonawanekiranCommented:
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now