Hi Frnds
I am sending to u my code ...but i am stuck in if i click on add button new row is not be add on the web grid in mvc4
please chek the code and give the solution
Model////
public class UserModel
{
public int ID { get; set; }
public string Name { get; set; }
public string LastName { get; set; }
//public static List
//{
// List
// {
// new UserModel();
// /*{ ID = 1, Name = "Anubhav", SurName = "Chaudhary" }; */
// };
// users.Add(new UserModel());
// //{ ID = 1, Name = "Anubhav", SurName = "Chaudhary" });
// return (users);
//}
public static List
{
List
{
new UserModel (){ ID=4, Name="Jyoti", LastName="Mishra" },
new UserModel (){ ID=5, Name="Shayli", LastName="Shamra" },
};
return users;
}
}
Views////
@{
ViewBag.Title = "Index";
}
WEB GRID
@{
var grid = new WebGrid(Model);
}
@grid.GetHtml(
columns:
grid.Columns(
grid.Column("ID", format: @
@item.ID
grid.Column("Name", "Name", format: @
grid.Column("LastName", "LastName", format: @
)
))
@*Add button for adding the textbox*@
Controller/////
public ActionResult Index()
{
List
return View(users);
}
Anjali KhanPosted Aug 30, 2016, 12:51 AM
Midhun TpPosted Aug 26, 2016, 1:51 PM
Please check below links also - https://adevelopersnotes.wordpress.com/2014/01/22/why-is-jquery-referenced-in-body-tag-with-a-defaul-asp-net-mvc-4-application/ http://stackoverflow.com/questions/17733509/is-not-defined-asp-net-mvc-4
Anjali KhanPosted Aug 26, 2016, 12:56 PM
Midhun TpPosted Aug 26, 2016, 12:38 PM