Click here to Skip to main content
15,888,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have from for edit user
i want when edit Completed button edit is disable=true

HTML
<input class="btn btn-primary btn-default" name="commit" value="edit" type="submit"   />

C#
[HttpPost]
     [ValidateAntiForgeryToken()]

      public ActionResult EditUser(User postData, object usecaseobject)
      {
            if (ModelState.IsValid)
           {
              string status = "1";
              User _User = new User();

                  db.Entry(postData).State = EntityState.Modified;
                  db.SaveChanges();
                  ViewBag.name = "succss";
                  //here disable button

          }
            return View(postData);

      }
Posted
Comments
Dinesh.V.Kumar 9-Jan-15 7:46am    
You can not directly disable a control in a view from controller. You need to pass the model to the view. Based on the model data you can enable or disable the control.
eg:
Solution 1:

Assuming User is a model
User.Status = "success";
return View(postData, User);

In view
if(Model.User=="success")
--add control set the disabled state here
else
--add control without disabled state.


Solution 2:
You can redirect to another view that shows the success message to the user so that the user cannot do anything in the previous view.

Hope this helps

Regards

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