I'm working on displaying tabular data from a SQL database in a 'aspx' page that I added into an mvc template project I have made inside Visual Studio 2013.
I have a SQL DataSource connected to a database bringing back a basic table. I can display the information in the 'DataTable.aspx' file. I am not able to get the dataTables.js or the .css files to run. Or I do not think that they are running. This is what I have checked so far..
- I can see jquery as having loaded, and I did install both jquery and datatables in the 'NuGet' package manager through Visual Studio 2013 (demo)
The .net tab in FireFox (sometimes shows that the .js and .cs files in the debug session in black or gray.
-I think my 'DataTables.aspx' file is correct (below).<%: Title %>.
TaskTable
<div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TaskRFIDatabaseConnectionString %>" SelectCommand="SELECT [TaskID], [TaskTypeID], [TaskCreatedBy], [TaskName], [TaskDescription], [TaskCreatedDateTime] FROM [TaskTable]"> </asp:SqlDataSource> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <HeaderTemplate> <table id="DataTable"> <thead> <tr> <th>TaskID</th> <th>TaskTypeID</th> <th>TaskCreatedBy</th> <th>TaskName</th> <th>TaskDescription</th> <th>TaskCreatedDateTime</th> </tr> </thead> </HeaderTemplate> <ItemTemplate> <tr> <td><%# Eval("TaskId") %></td> <td><%# Eval("TaskTypeID") %></td> <td><%# Eval("TaskCreatedBy") %></td> <td><%# Eval("TaskName") %></td> <td><%# Eval("TaskDescription") %></td> <td><%# Eval("TaskCreatedDateTime") %></td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </div>
The site master has the references to the .js and .css files for dataTables.
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Compass.SiteMaster" %>
<!DOCTYPE html>
<html lang="en">
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %> - Compass</title>
<link href="Content/DataTables-1.10.3/css/jquery.dataTables.css" rel="stylesheet" />
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/DataTables-1.10.3/media/js/jquery.dataTables.js"></script>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/Content/css" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
</head>
<body>
<form runat="server">
<asp:ScriptManager runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--Framework Scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
<%--Site Scripts--%>
</Scripts>
</asp:ScriptManager>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" runat="server" href="~/">Application name</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a runat="server" href="~/">Home</a></li>
<li><a runat="server" href="~/About">About</a></li>
<li><a runat="server" href="~/Contact">Contact</a></li>
<li><a runat="server" href="~/DataTable">DataTable</a></li>
</ul>
<asp:LoginView runat="server" ViewStateMode="Disabled">
<AnonymousTemplate>
<ul class="nav navbar-nav navbar-right">
<li><a runat="server" href="~/Account/Register">Register</a></li>
<li><a runat="server" href="~/Account/Login">Log in</a></li>
</ul>
</AnonymousTemplate>
<LoggedInTemplate>
<ul class="nav navbar-nav navbar-right">
<li><a runat="server" href="~/Account/Manage" title="Manage your account">Hello, <%: Context.User.Identity.GetUserName() %> !</a></li>
<li>
<asp:LoginStatus runat="server" LogoutAction="Redirect" LogoutText="Log off" LogoutPageUrl="~/" OnLoggingOut="Unnamed_LoggingOut" />
</li>
</ul>
</LoggedInTemplate>
</asp:LoginView>
</div>
</div>
</div>
<div class="container body-content">
<asp:ContentPlaceHolder ID="HeaderContent" runat="server">
<link href="Content/DataTables-1.10.3/css/jquery.dataTables.css" rel="stylesheet" />
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/DataTables-1.10.3/jquery.dataTables.js"></script>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
<hr />
<footer>
<p>© <%: DateTime.Now.Year %> - My ASP.NET Application</p>
</footer>
</div>
</form>
</body>
</html>
Where else would you check? All of the examples I have read have been either dealing with a simple page or are using different methods. This is from a base web/mvc template from Visual Studio 2013 and jQuery dataTables.js installed through NuGet.
Some of the other pages I have already hit: jQuery DataTable not working in asp.net mvc 4
http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part
Is there anyplace else I should be looking? Andy..