This question is locked. New answers and comments are not allowed.
I have data in my Model class:
public class Person
{
[Required]
public int id { get; set; }
[Required]
public string name { get; set; }
[Required]
public int age { get; set; }
public List<Person> GetPersons()
{
List<Person> p = new List<Person>() { new Person() { id=1, name="Andre", age=10},
new Person() { id=2, name="Bennie", age=20},
new Person() { id=3, name="Roel", age=30},
new Person() { id=4, name="Jeroen", age=40},
new Person() { id=5, name="Arjan", age=50},
new Person() { id=6, name="PietJan", age=60},
new Person() { id=7, name="Alex", age=70},
new Person() { id=8, name="Wim", age=80},
new Person() { id=9, name="Jan", age=90},
//new List<B) { }
};
return p;
}
There is a function in Controller which returns the data from GetPersons
In .cshtml file i m binding the grid to GetPersons to display data. But nothing displays on the screen. There is no grid on the screen. What am i doing wrong
Html.Telerik().Grid(this.Model)
.Name("grdPersonView")
.Columns(columns =>
{
columns.Bound(p => p.id);
columns.Bound(p => p.age);
columns.Bound(p => p.name);
})
.Pageable(pager => pager.PageSize(20))
.Sortable(sorting =>
{
sorting.SortMode(GridSortMode.MultipleColumn);
sorting.OrderBy(sortOrder => sortOrder.Add(p => p.id));
}
);
public class Person
{
[Required]
public int id { get; set; }
[Required]
public string name { get; set; }
[Required]
public int age { get; set; }
public List<Person> GetPersons()
{
List<Person> p = new List<Person>() { new Person() { id=1, name="Andre", age=10},
new Person() { id=2, name="Bennie", age=20},
new Person() { id=3, name="Roel", age=30},
new Person() { id=4, name="Jeroen", age=40},
new Person() { id=5, name="Arjan", age=50},
new Person() { id=6, name="PietJan", age=60},
new Person() { id=7, name="Alex", age=70},
new Person() { id=8, name="Wim", age=80},
new Person() { id=9, name="Jan", age=90},
//new List<B) { }
};
return p;
}
There is a function in Controller which returns the data from GetPersons
In .cshtml file i m binding the grid to GetPersons to display data. But nothing displays on the screen. There is no grid on the screen. What am i doing wrong
Html.Telerik().Grid(this.Model)
.Name("grdPersonView")
.Columns(columns =>
{
columns.Bound(p => p.id);
columns.Bound(p => p.age);
columns.Bound(p => p.name);
})
.Pageable(pager => pager.PageSize(20))
.Sortable(sorting =>
{
sorting.SortMode(GridSortMode.MultipleColumn);
sorting.OrderBy(sortOrder => sortOrder.Add(p => p.id));
}
);