Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to generate new row in webgrid on asp.net mvc4
    primarykey
    data
    text
    <p>I am having Text Box and a Button.I need to add Text Box value in Web grid when button was clicked.I coded to add text box value in grid but in the same column cell the value will be updated. I need to generate new column and add values ... </p> <p>Index.cshtml Code</p> <pre><code>@{ @Html.TextBox("Value", "", new { id = "txtid" }) &lt;input type="button" value="Submit" onclick="onSelectedIndexChanged()" id="btn" /&gt; WebGrid grid = new WebGrid(Model, selectionFieldName: "SelectedRow"); @grid.GetHtml( columns: grid.Columns( grid.Column("Edit", header: null, format: @&lt;text&gt;@item.GetSelectLink("Edit")&lt;/text&gt;), grid.Column("Firstname", format: @&lt;text&gt;@item.GivenName&lt;/text&gt;), grid.Column("Surname", format: @&lt;text&gt;@item.Surname&lt;/text&gt;), grid.Column("Age", format: @&lt;text&gt;@item.Age&lt;/text&gt;) ) ) } </code></pre> <p>Models Code: People.cs</p> <pre><code>public ObservableCollection&lt;People&gt; GetCustomerList(string firstname) { ObservableCollection&lt;People&gt; CustomerList = new ObservableCollection&lt;People&gt;(); DataTable dtCustomer = new DataTable(); CustomerList.Add(new People { Id = i, GivenName = firstname, Surname = "Kumar", Age = 25 }); i++; return CustomerList; } </code></pre> <p>Controller Code: Home Controller.cs public ActionResult GetPeople(string firstname) {</p> <pre><code> //List&lt;People&gt; ItemList = new List&lt;People&gt;(); // ViewBag.Items = ItemList; ObservableCollection&lt;People&gt; ItemList = new ObservableCollection&lt;People&gt;(); People Customer = new Models.People(); ItemList = Customer.GetCustomerList(firstname); return PartialView("Index", ItemList); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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