Build a Lambda Expression Dynamically For Sort Acs/Desc

I have tried writing my own basic dynamic lambda expression for sorting the columns in grid panel. There are columns with different property type, and a few link to other object. In this example Branch column (in computer object as a property) is link to Lookup object. I want to order by display field in …

Continue reading Build a Lambda Expression Dynamically For Sort Acs/Desc

Binding Bootstrap Dual ListBox with ASP.NET MVC

I have use duallist box from http://www.virtuosoft.eu/code/bootstrap-duallistbox/  to populate list of staff entity from controller that come back from a json request. To load unselected and selected staff at the same time and display the unselected staff on the left side of dual listbox while selected one on right side. In html: In content:  <%: Styles.Render( <%: …

Continue reading Binding Bootstrap Dual ListBox with ASP.NET MVC

Return PDF/TXT/XLS/PXLS to browser in ASP.NET MVC using crystal report

This example is using SAP crystal report for Visual studio. Can get a copy here for free. Below sample show how to generate different file type format report to the browser dynamically.   In Controller: public ActionResult PrintReport(string filters, string fileType) { var page = FilterPage(new Page<StaffOrder>(), filters); report = ReportUtil.GetReport<StaffOrder, StaffOrderReport>(StaffOrderModel.PropertyNames, page.result.OrderBy(x => x.StaffName).ThenBy(z …

Continue reading Return PDF/TXT/XLS/PXLS to browser in ASP.NET MVC using crystal report

Making a Simple Ajax call to controller in asp.net mvc to load data into dropdownlist

Controller: Public Function Get_Plant() As ActionResult Dim plantrole As New PlantRequestParam Dim rinfo = New Common.ResultInfo rinfo = iPlant.GetAllActiveList(plantrole) Return Json(rinfo) End Function View: var AjaxUrl = "../Home/Get_Plant"; $.ajax({ type: 'POST', url: AjaxUrl, contentType: 'application/json; charset=utf-8', success: function (data) { if (data.Status == true) { var taglist = data.Data; $.each(taglist, function (index, value) { var …

Continue reading Making a Simple Ajax call to controller in asp.net mvc to load data into dropdownlist

Authorization failure for Ajax request in MVC application

I encounter an ajax request authorization failure and causes bad user experience. I had click on a button which require ajax response in my ASP.net MVC application which already timout. Below is the way to handle it properly without getting any bugs. I have created a OnAuthorizationModule action filter to check on each action to determine …

Continue reading Authorization failure for Ajax request in MVC application

HTTP Error 401.0 – Unauthorized

After login, unable to access the pages and below error message display. solution: Go to the project property 2. Change the 'Window Authentication' setting to 'Enabled'         A Philosophy of Software Design This book addresses the topic of software design: how to decompose complex software systems into modules (such as classes and …

Continue reading HTTP Error 401.0 – Unauthorized