Problem with MVC3 and DataTable
Problem with MVC3 and DataTable
Hi all.
I have a problem with DataTables integration to MVC3 project. Over 7 hours I'm trying to fix this problem, but it's beyond my power :)
But at once a've had good result: when I created new View without masterpage and put directly to header all the jquery.dataTables.min.js file code, but when I tried to repeat this trick at the layout page header - it didn't work. So I'm out and ask you for help.
Now I'll try to explain how i did that.
Here is my Layout's page header:
[code]
Example
@Styles.Render("~/Content/themes/base/css", "~/Content/css")
@Scripts.Render("~/bundles/modernizr")
[/code]
And here is table building:
[code]
Name
Orders
Status
Delete
@{
foreach (var c in ViewBag.CampaignsList)
{
@Html.ActionLink((string)c.CampaignName, "EditCampaign", controllerName: "Campaign", routeValues: new { cid = c.CampaignId }, htmlAttributes: null)
@c.CampaignMinPrice.ToString("F")
@c.CampaignMaxPrice.ToString("F")
@c.CampaignMaxBudget.ToString("F")
@Html.ActionLink((string)c.CampaignOrdersCount, "ManageOrders", controllerName: "Order", routeValues: new { cid = c.CampaignId }, htmlAttributes: null)
(@Html.ActionLink((string)c.CampaignOpenOrdersCount, "ManageOrders", controllerName: "Order", routeValues: new { cid = c.CampaignId, status = "open" }, htmlAttributes: null)|
@Html.ActionLink((string)c.CampaignClosedOrdersCount, "ManageOrders", controllerName: "Order", routeValues: new { cid = c.CampaignId, status = "closed" }, htmlAttributes: null))
@Html.ActionLink("Delete", "DeleteCampaign", new { cid = c.CampaignId })
}
}
[/code]
And script-file:
[code]
$(document).ready(function () {
$("#campaigns-table").dataTable();
});
[/code]
Look forward to your help.
I have a problem with DataTables integration to MVC3 project. Over 7 hours I'm trying to fix this problem, but it's beyond my power :)
But at once a've had good result: when I created new View without masterpage and put directly to header all the jquery.dataTables.min.js file code, but when I tried to repeat this trick at the layout page header - it didn't work. So I'm out and ask you for help.
Now I'll try to explain how i did that.
Here is my Layout's page header:
[code]
Example
@Styles.Render("~/Content/themes/base/css", "~/Content/css")
@Scripts.Render("~/bundles/modernizr")
[/code]
And here is table building:
[code]
Name
Orders
Status
Delete
@{
foreach (var c in ViewBag.CampaignsList)
{
@Html.ActionLink((string)c.CampaignName, "EditCampaign", controllerName: "Campaign", routeValues: new { cid = c.CampaignId }, htmlAttributes: null)
@c.CampaignMinPrice.ToString("F")
@c.CampaignMaxPrice.ToString("F")
@c.CampaignMaxBudget.ToString("F")
@Html.ActionLink((string)c.CampaignOrdersCount, "ManageOrders", controllerName: "Order", routeValues: new { cid = c.CampaignId }, htmlAttributes: null)
(@Html.ActionLink((string)c.CampaignOpenOrdersCount, "ManageOrders", controllerName: "Order", routeValues: new { cid = c.CampaignId, status = "open" }, htmlAttributes: null)|
@Html.ActionLink((string)c.CampaignClosedOrdersCount, "ManageOrders", controllerName: "Order", routeValues: new { cid = c.CampaignId, status = "closed" }, htmlAttributes: null))
@Html.ActionLink("Delete", "DeleteCampaign", new { cid = c.CampaignId })
}
}
[/code]
And script-file:
[code]
$(document).ready(function () {
$("#campaigns-table").dataTable();
});
[/code]
Look forward to your help.
This discussion has been closed.
Replies
[code]
@section scripts {
}
[/code]
directly to the view