This question is locked. New answers and comments are not allowed.
Hi,
I'm using a Grid and Menu on the same page. The Menu has an item which fires an Action that exports the Grid to an Excel file, as per the sample provided here: http://www.telerik.com/support/kb/aspnet-mvc/grid/export-to-excel.aspx
This code looks something like the following:
This is all fine and well, the Action fires and the Save file dialog opens to save the Excel file. However, the code is severely limited because in the controller method, I have to set column widths and field values. It would be great if I could pass a reference to the Grid control in the routeValues of the Action and then interrogate the grid for it's columns, widths and bindings, something like:
I'm using a Grid and Menu on the same page. The Menu has an item which fires an Action that exports the Grid to an Excel file, as per the sample provided here: http://www.telerik.com/support/kb/aspnet-mvc/grid/export-to-excel.aspx
This code looks something like the following:
<%
Html.Telerik().Menu()
.Name(
"clientsmenu")
.Items(items =>
{
items.Add()
.Text(
"Export")
.ImageUrl(
"/Content/Images/Icons/xls.png")
.Action(
"ExcelExport", "Clients", new { page = 1, orderBy = "~", filter = "~" });
})
.Render();
%>
Additionally, the controller looks like this:
public ActionResult ExcelExport(int page, string orderBy, string filter)
{
}
This is all fine and well, the Action fires and the Save file dialog opens to save the Excel file. However, the code is severely limited because in the controller method, I have to set column widths and field values. It would be great if I could pass a reference to the Grid control in the routeValues of the Action and then interrogate the grid for it's columns, widths and bindings, something like:
.Action(
"ExcelExport", "Clients", new { page = 1, orderBy = "~", filter = "~", grid = this.FindControl("clientsgrid") });
Unfortunately nothing comes through at the controller. Can anybody pls advise how this might be possible?
Thanks