Note that there are some explanatory texts on larger screens.

plurals
  1. POWebGrid control issue in Mvc4
    text
    copied!<p>I am new in MVC and I'm trying to use WebGird control in my demo application I do some task like below:-</p> <p><strong>HomeController</strong></p> <pre><code>public ActionResult Index() { List&lt;Student&gt; listStudent = new List&lt;Student&gt;(); listStudent.Add(new Student { Id = 1000, Name = "Sumit Kesarwani", IsActive = true }); listStudent.Add(new Student { Id = 1001, Name = "Arun Singh", IsActive = true }); listStudent.Add(new Student { Id = 1002, Name = "Vijay Shukla", IsActive = false }); listStudent.Add(new Student { Id = 1003, Name = "Pwan Shukla", IsActive = true }); var data = listStudent; return View(data); } </code></pre> <p><strong>Student.cs</strong></p> <pre><code>public class Student { public int Id { get; set; } public string Name { get; set; } public bool IsActive { get; set; } } </code></pre> <p><strong>Index.cshtml</strong></p> <pre><code>@model IEnumerable&lt;MvcWebGrid.Models.Student&gt; @{ ViewBag.Title = "Home Page"; WebGrid webGrid = new WebGrid(Model); } @webGrid.GetHtml(columns: new[]{ webGrid.Column("Id"), webGrid.Column("Name"), webGrid.Column("IsActive", header: "", format:@&lt;text&gt;&lt;input name="isActive" type="checkbox" @item.IsActive == "true" ? "checked" : ""/&gt;&lt;/text&gt;) }) </code></pre> <p>Above <code>WebGrid</code> will show all data in <code>readonly</code> mode, but I need those data will show in editable mode such as Id will show in Hidden field, Name will shows in <code>Textbox</code> and when data load <code>checkbox</code> will checked if its property have true value the <code>checkbox</code> will checked and if property have false value then <code>checkbox</code> will <code>uncheck</code>. </p> <p>Please Please Please Help me!</p> <p>Any help will be appreciated! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload