Friday, 13 July 2012

Asp.net MVC 4 application with Flexigrid, jQuery UI, and jQuery validation

2 comments
Almost all applications expose four fundamental operations on entities such as Create, Read, Update, and Delete (CRUD). In general terms these will relate to:



  • Create new entities
  • List, search, or view existing entities
  • Update existing entities
  • Delete existing entities

  • Building a web application using Asp.Net MVC framework with CRUD operations will result in a separate view for each operation (except delete). Also controller classes will have a set of action methods (http get / post) for each view.

    It is a quick and straightforward to implement such CRUD pattern. But this pattern is not user friendly and results in the bigger code base and the higher bandwidth consumption.
    The other approach to implement CRUD UI is using AJAX with jQuery based components. This should make user experience is more enjoyable and the much better technologies utilization. I have created a simple DEMO application called “Job Market” using following technologies:



  • Asp.Net MVC 4
  • Flexigrid (jQuery based rich data grid)
  • jQuery UI
  • jQuery Validation
  • Linq to XML


  • This application built with standard Asp.Net MVC 4 template. A Jobs section lists job posts using Flexigrid. The Flexigrid control provides all required functionality such as paging, sorting, column resizing / hiding, and many more. Adding and editing facilities are implemented using jQuery UI dialog forms with jQuery validation plugin for client side validation. This combination (grid with dialogs) is utilizing AJAX techniques with JSON to query or post data. A data repository for this sample is stored in xml file and using LINQ to XML interface for CRUD operations.

    The code from this demo can be used as a pattern for building repetitive tasks in CRUD web applications.

    Check the demo source code here (built with Visual Studio 2012).
    Read More...

    Thursday, 8 March 2012

    Warm up the Web application and SQL Server Reporting Services on Windows Server

    3 comments
    Let me share the way of warming up the web application and also SSRS with the help of VB script running from the scheduled task. This will keep the applications alive and avoid the problem of long delays on the first hit after some period of inactivity.

    The VB script presented below sends the GET request to the designated URL using the ServerXMLHTTP object. We can pass the username and password to authenticate the request for reporting services.

    Dim strURL
    Set webObj = CreateObject("MSXML2.ServerXMLHTTP")
    ' Replace below URL with the URL of your report in the reporting server
    ' Replace below Username and Password with your credentials
    strURL = "http://MyReportServer/Reports/Pages/Report.aspx?ItemPath=MyReport"
    webObj.Open "GET", strURL, False, "Username", "Password" 
    webObj.send
    ' For debugging - uncomment the line below to check the response status
    ' MsgBox(webObj.Status)
    
    ' Replace below URL with the URL of your web application
    strURL = "https://myapplication.com"
    webObj.Open "GET", strURL 
    webObj.send
    ' For debugging - uncomment the line below to check the response status
    ' MsgBox(webObj.Status)
    
    Set webObj = Nothing
    

    Save the script as text file with .vbs extension. Then we can test it from cmd by using the command below.
    wscript C:\warm-up-script.vbs
    
    To make this script running periodically, let's say every 15 minutes, create the scheduled task. See the screenshots below.





    That's it!
    Read More...