mardi 25 juillet 2017

How to save the checkboxes as Key-value pairs in asp.net webforms

I have a sql server table with id, key and value as columns and in the front end I have bunch of checkboxes. I need to save the checkbox selections into the database. I know process to save it when there is a separate column for each checkbox in the table, but, currently all the values are saved as key for example: test and Value: 1 if checkbox is selected. I have used checkbox control like this:

<div class="form-group">
                                                        <div class="check">
                                                            <asp:CheckBox runat="server" ID="ChkReviewsubmit" Text="Review/Submit" />
                                                            <br />
                                                            <asp:CheckBox runat="server" ID="ChkStatuschange" Text="Show Status Change Options" />
                                                            <br /> 
</div>
</div>

How do I save checkbox selections as the key value pairs? Can someone please provide me with any examples.

Thanks in advance.

Dimpy




Aucun commentaire:

Enregistrer un commentaire