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);
}
Midhun TpPosted Sep 7, 2016, 12:21 AM
Midhun TpPosted Sep 7, 2016, 2:04 AM
Anjali KhanPosted Sep 7, 2016, 1:08 AM
hey
if i added a new row and fillup and add again new row
previous data is showing on new row?
Anjali KhanPosted Sep 7, 2016, 1:01 AM
Anjali KhanPosted Sep 7, 2016, 12:15 AM
why new row is adding after the button..or it is adding outside the grid ..means i want only row should be add on grid..
Anjali KhanPosted Sep 6, 2016, 4:29 AM
Midhun TpPosted Sep 6, 2016, 3:50 AM
Anjali KhanPosted Sep 6, 2016, 3:50 AM
Vinay SinghPosted Sep 6, 2016, 3:29 AM
{
List
return View(users);
}
{
List
return View(users);
}
Midhun TpPosted Sep 6, 2016, 3:18 AM
Midhun TpPosted Sep 6, 2016, 2:52 AM
Midhun TpPosted Sep 6, 2016, 2:43 AM
Anjali KhanPosted Sep 6, 2016, 12:46 AM
Anjali KhanPosted Aug 26, 2016, 5:26 AM
Anjali KhanPosted Aug 26, 2016, 3:32 AM
Vinay SinghPosted Aug 26, 2016, 3:11 AM