Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 5 types of users if I check the check boxes and click on update button I have to update all the checked values of each type basing on id on one click

What I have tried:

I just bound the values to web grid by using entity model if I click on the update button I have to update each staff checked checkbox values by using id in asp.net MVC
Posted
Updated 5-Apr-16 23:54pm
v3
Comments
Member 12377320 8-Mar-16 6:35am    
postimg.org/image/5qt5k0rd1
John C Rayan 8-Mar-16 7:30am    
what's your issue? show us your controller and view.
Member 12377320 8-Mar-16 9:35am    
this is view
<div>
@grid.GetHtml(columns: grid.Columns(grid.Column(columnName: "UId", header: "U ID"),
grid.Column(columnName: "UserType_Name", header: "UserTypeName"),
grid.Column(header: "AddR", format: @<text><input type="checkbox" id="chkadd" checked="@item.AddRights" />),
grid.Column(header: "EditR", format: @<text><input type="checkbox" id="chkedit" checked="@item.EditRights" />),
grid.Column(header: "DeleteR", format: @<text><input type="checkbox" id="chkdel" checked="@item.DeleteRights" />),
grid.Column(header: "ChpwdR", format: @<text><input type="checkbox" id="chkpwd" checked="@item.Change_pwd" />),
grid.Column(header: "AssignR", format: @<text><input type="checkbox" id="chkassign" checked="@item.AssignRights" />),
grid.Column(header: "UpdateR", format: @<text><input type="checkbox" id="chkupdate" checked="@item.UpdateRights" />)

))
</div>
</td>
</tr>

</table>

<div>
@Html.ActionLink("Update", "UserPermissionSettings")
</div>
Member 12377320 8-Mar-16 9:36am    
this is controller
[HttpGet]
[ActionName("UserPermissionSettings")]
public ActionResult UserPermissionSettings()
{
if (Session["Name"] == null)
{
return RedirectToAction("Login");
}
else
{
var upsettings = new List<userpermissionsetting>();

using (UPSettingsEntities upsettingsEntities = new UPSettingsEntities())
{
upsettings = upsettingsEntities.UserPermissionSettings.ToList();


}

return View(upsettings);
}
}
Member 12377320 8-Mar-16 9:39am    
the link above is the output if click on the update button I have to update the all the checked or unchecked values of the checkbox to DB please help me...

1 solution

The answer is here for you.

mvc3 checkbox checked rows in the web grid[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900