Dynamic Javascript using ASP.NET MVC

Create a new MVC applictaion Open /Views/Shared/Site.Master <script src=”/Scripts/script.js” type=”text/javascript”></script> This doesn’t point to anything yet Open Global.asax Add a MapRoute routes.MapRoute(“Javascript”, “Scripts/{scriptFile}.js”, new { controller = “Scripts”, action = “Index”, scriptFile = “script” }); Now /Scripts/script.js points to Script/Index Add a view for CssController/Index <%= Url.Content(“~/Content/test.jpg”) %> Change contenttype in page directive of Views/Scripts/Index.aspx… Continue reading Dynamic Javascript using ASP.NET MVC

Dynamic CSS using ASP.NET MVC

I’ve been considering the usefulness of adding a CSS management system to my CMS that I’ve been working on. Here are the steps I’ve taken to implement it. Create a new MVC applictaion Open /Views/Shared/Site.Master <link href=”/Css/Site.css” rel=”stylesheet” type=”text/css” /> This doesn’t point to anything yet Open Global.asax Add a MapRoute routes.MapRoute(“Css”, “Css/{cssFile}.css”, new {… Continue reading Dynamic CSS using ASP.NET MVC

SCOPE_IDENTITY() with LINQ

While reading about a recent question concerning @@Identity and the reasons to use SCOPE_IDENTITY() instead I experimented with LINQ to get the SCOPE_IDENTITY() results. using (var dbc = new siteDataContext()) { dbc.Log = Console.Out; repertoire newSkill = new repertoire { skill = “a new item” }; dbc.repertoires.InsertOnSubmit(newSkill); dbc.SubmitChanges(); Console.Write(newSkill.id.ToString()); } It seems that calling the… Continue reading SCOPE_IDENTITY() with LINQ

Adding AJAX to an existing project that includes Routing

I was working on a project and just on a whim decided to try out some of .NET’s AJAX controls. I chose a random page, added a ScriptManager, tossed in a TextBox and a CalendarExtender. F5. Page shows up. Javascript error: Line: 121 Char: 1 Error: ‘Sys’ is undefined Code: 0 Url: http://localhost:49329/admin.aspx Hmm. Try… Continue reading Adding AJAX to an existing project that includes Routing

Working on Bible Verse Tags for ASP.NET (C#)

To do: build Regex to detect bible verses in tags put in named back-references find a way to choose different tables with LINQ make it work for an entire chapter add error messages move it to a class file instead of in the page run it from the filterText method if IndexOf(“[bible]”) !=-1 fix toVerse… Continue reading Working on Bible Verse Tags for ASP.NET (C#)