[HttpPost]
public ActionResult UserAccount(List items)
{
string Rolename = "";
int Roleid = 0;
string userid = "";
string updatedby = "";
string name = Request.Form["Txt_userid"].ToString(); //error linene please see view and controller //below
foreach (SelectListItem item in items)
{
if (item.Selected)
{
Rolename = item.Text;
Roleid = Convert.ToInt32(item.Value);
userid = "6090";
updatedby = "admin";
AIS.InsertRole_status(Roleid, 1, userid, updatedby);
}
else
{
Rolename = item.Text;
Roleid = Convert.ToInt32(item.Value);
userid = "6090";
updatedby = "admin";
AIS.InsertRole_status(Roleid, 0, userid, updatedby);
}
}
return View(items);
// UserAccount UA = new UserAccount();
// UA.SuperUsrChk = true;
// UA.RequestorUsrChk = false;
// // return View(new UserAccount { SuperUsrChk = true });
// return View(UA);
}
view
@model List
@{
ViewBag.Title = "UserAccount";
}
@Scripts.Render("~/bundles/jquery")
$(document).ready(function () {
$('#searchrole').click(function () {
debugger
$.ajax({
url: '@Url.Action("UserAccountWithid", "Admin")',
type: 'GET',
data: { Uid: $("#Txt_userid").val() },
cache: false,
success: function (data) {
$("#contact").html(data);
$header = $('.header');
$("#div1").show();
$header1 = $('.header tr td');
var x = $header.find('td');
var k = $header1.find('div');
$('.panel-body').on('scroll', function () { $header.css('top', $(this).scrollTop()); });
//var wi = new Array();
//$('.dt tr').eq(0).find('td').each(function (e) {
// k.eq(e).width($(this).width() );
// wi.push(k.eq(e).width());
//});
$('.dt thead tr td div').each(function (e) {
k.eq(e).width($(this).width());
});
},
error: function () {
// handle ajax error
}
});
});
});
@using (Html.BeginForm("UserAccount", "Admin"))
{
UserId
@Html.CheckBoxFor(m => m[i].Selected) | @Html.DisplayFor(m => m[i].Text) @Html.HiddenFor(m => m[i].Value) @Html.HiddenFor(m => m[i].Text) |
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hiten PandyaPosted Feb 4, 2018, 10:29 PM