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

Simple way of adding a row of textboxes dynamically for input

How to add a row of column dynamically when user click the link to add new row? Below illustration were done in MVC framework whereby as it is not as easy as using the control directly in web form. These concerns are populate data into the drop down list, passing back all newly added data …

Continue reading Simple way of adding a row of textboxes dynamically for input

NHibernate to handle search and paging from stored procedure

Basically my task is to create a page that display data in grid, able to filter (search), and print the data I retrieve from a stored procedure using NHibernate. I will pass a filter with few parameter into the SP to retrieve the data to be display. In xml file, I have added 'sql-query' query …

Continue reading NHibernate to handle search and paging from stored procedure

Web Programming guide – Inserting data using SQL data source controller

In developing web base system, retrieving and inserting data is a basic thing. As in ASP.NET, it makes development easy. As we're going to explore one of the control-SqlDataSource control which I have tested it out with a simple web application form name 'NewContract.aspx' in SCM test n error 2 project. Let's  start from the …

Continue reading Web Programming guide – Inserting data using SQL data source controller