• Using ASPX Like MVC

    I love the organization of MVC when it comes to delivering content. Using a server-side controller you can see all the routing activity of your program. The controller can interact with the parent view as well as related partials, passing data and rendering html. Related views are also tucked-away together in the tree making it easy to pinpoint what you’re looking for. The default layout of WebForms is a different kind of animal. But using MVC experience as a reference you can structure your project to work in a similar way. To begin we want to create a Views folder

    [Read More...]
  • Ajax to Retrieve HTML Segments from Single ASPX

    Have you ever wanted to have one ASPX file that can render normal content as well as dynamic content? The dynamic content can return HTML that utilizes ASPX server controls. The segment returned is not cloned from hidden markup preexisting on the page, but rather is foreign and new as far as the DOM is concerned. If so then follow these steps to create one relay station for all your content: In the aspx file we define a section that is reserved for our ajax request:

    Of course this page also has other HTML and script that will render/bind

    [Read More...]
  • Self-Closing Bootstrap Modal in MVC

    I had a need recently to alert users if the amount of records being selected differed from what they expected. My notice was more of a "heads up" then anything. Still, I wanted to give users a way to abort situations where job size would pose a threat or hinder productivity. I also wanted to avoid extra interface clicks, especially in situations where they typically accept. That’s when I came up with the idea of a self-closing dialog. The user would be presented a modal message informing them of the difference. To proceed they could press the Continue Immediately button,

    [Read More...]
  • Datatable Fundamentals Part 1

    I’m a big fan of jQuery Datatables. It’s my new grid of choice for interfacing. I jumped on the bandwagon at at the release of 1.10 which was a major versioning change/re-working. The documentation was lacking a bit at the time so I had to do a lot of trial and error to figure things out. I used jqGrid for years before making the transition. I find Datatables to be cleaner (as far as object organization) and more understandable. I feel that any programmer that comes behind me will have an easier time deciphering code I’ve written for Datatables verses

    [Read More...]
  • Show Bootstrap Tooltip Over Truncated Text

    I had a need to prevent text-wrapping in a cell. I wanted the text to appear truncated to keep the row height consistent. The following worked well to crop the text and show an indicator of hidden text:

    I referenced the classes like so:

    Next, I wanted the user to be presented a tooltip if the text was truncated so they could see the full value. Here is my solution:

    This snippet watches for mouse placement over the DIV. It then does some width comparisons to see if there is any hidden text. If so it

    [Read More...]
  • Ajax Script Loading that Enforces Order of Execution

    One awesome feature of jQuery is the ability to load external scripts on demand. The $.getScript method loads the script behind the scenes via ajax. In fact the function is simply an alias to call to jQuery’s $.ajax function. By default that alias does not look for a cached items. In my particular need I wanted to observe a cache and guarantee order of execution. I resorted to using the $.ajax function directly since it offers more options. I did not want a script to load before it’s dependency nor did I want to bog down my page by doing

    [Read More...]
  • AJAX and Bootstrap Tabbing in MVC

    In this tutorial you will see the Twitter Bootstrap tabstrip in action. I will be using MVC, Razor and jQuery to accomplish this. If you visit the tabstrip documentation you will see an example that uses static tab content. I have expanded upon that code snippet, converting it to dynamic content using AJAX. I’m also utilizing a fading transition effect as the content loads. The tabstrip will interact with two partial views named: _SearchTab.cshtml and _SubmissionTab.cshtml. Notice that I am naming the tab ids the same as the partial views. Doing that reduces translation in the script when relaying the

    [Read More...]
  • AutoHotKey – Start with Windows

    AutoHotkey is a free, open-source scripting platform for Windows. You can use it to automate repetitive, tedious tasks or to turn just about any action into a keyboard shortcut. Once a script has been written and compiled there may be a need to have it automatically start with Windows. There are two ways to do this: startup folders or the registry. Both techniques are explained below: Use a Shortcut This will create a shortcut in the common startup folder to launch an application:

    To create it in the user’s startup folder replace A_StartupCommon with A_Startup. Start in the Registry

    [Read More...]
  • SQL Server & XML

    Recently I was working on a stored procedure for datatable pagination in .NET. Instead of passing in multiple parameters consisting of arrays/associated arrays I opted to pass one XML value containing all the information in an organized fashion. But then I had to do my research on how to extract the data within SQL Server after the handoff. After some testing I discovered how to parse tags, and even attributes, before crafting a final, dynamic SELECT statement. I tested this technique with large amounts of records (i.e., 400,000+) with success in both web forms and MVC. The XML parsing time

    [Read More...]
  • jQuery Select2 Validation

    Since my recent post for jQuery TE Validation seems to be popular ( at least for my site ) I thought I would demonstrate how to validate another plugin that doesn’t work right out the gate. I’m referring to the Select2 plugin. It is a jQuery replacement for SELECT boxes with a BootStrap type of look. It can product a listbox similar to Facebook’s popular multi-select style. Other options include list item images, searching, sorting (with drag & drop), infinite scrolling, and much more. We will be validating it with the jQuery Validation plugin. This example uses the following external

    [Read More...]