Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to save checkbox checked values in Database [closed]
- public ActionResult Save(int id, bool status){}
- @Html.CheckBox("somename", item.Status)
- <input name="somename" type="hidden" value="false"/>
- @using(Html.BeginForm()) {
- @Html.Checkbox(...)
- }
- <script type="text/javascript">
- $(document).ready(function () {
- $('form').ajaxForm({
- success: Saved,
- error: HandleError
- });
- });
- function Error(response, status, err) {
- // code to handle error here
- }
- function Saved(responseText, statusText, xhr, $form) {
- // code to handle succes, if any
- }
- </script>
- public ActionResult Save(int id, bool status){}
- public class Settings
- {
- public bool Status { get; set; }
- // more properties here
- }
- public ActionResult Save(int id, Settings settings){}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement