0

I have make a dynamic gridview in asp.net mvc3 view engine is aspx. i have to bind datasource gridview. how bind datasource to grid view. and i had to add templete in gridview.

2 Answers 2

1

You could have found this answer yourself if you would do some research but here are some links that could help you:

http://weblogs.asp.net/andrebaltieri/archive/2010/11/01/asp-net-mvc-3-working-with-webgrid.aspx

http://weblogs.asp.net/shijuvarghese/archive/2010/10/08/using-the-webgrid-helper-in-asp-net-mvc-3-beta.aspx

http://www.unboxedsolutions.com/sean/archive/2011/01/23/15964.aspx

could be something like this:

@{
var grid = new WebGrid(canPage: true, rowsPerPage: ThisController.PageSize, canSort: true,    ajaxUpdateContainerId: "grid");
grid.Bind(Model.Employees, rowCount: Model.TotalRecords, autoSortAndPage: false);
grid.Pager(WebGridPagerModes.All);
@grid.GetHtml(htmlAttributes: new { id="grid" },
    columns: grid.Columns(
        grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { EmployeeID = item.EmployeeID, ContactID = item.ContactID })),
        grid.Column("FullName"),
        grid.Column("Title")
    ));
}
Sign up to request clarification or add additional context in comments.

Comments

0

Are you using MVC .NET or WebForms?

Which grid view are you talking about?

Have you seen these links:

Create GridView in asp.net MVC3.0

http://forums.asp.net/t/1687421.aspx/1?Gridview+in+MVC+3

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.