Skip to main content

Posts

Showing posts from June, 2014

ASP.NET MVC Generate Crystal report to pdf

See the code sample: public ActionResult GenerateReport(CustomerPackageReportViewModel CustomerPackageReportViewModel) { List<CustomerPackageDetailsReportViewModel> _customerList = (List<CustomerPackageDetailsReportViewModel>)Session["CustomerPackageInfo"]; DataTable tableObj = new DataTable(); if (_customerList!=null) { tableObj = Converter.ToDataTable(_customerList); } else { tableObj = Converter.ToDataTable(ArchitectureList); } ReportDocument reportDoc = new ReportDocument(); string rptPath = ""; rptPath = Server.MapPath("~/Reports/Billing/Crystal/rptCustomerPackage.rpt"); reportDoc.Load(rptPath); reportDoc.SetDataSource(tableObj); Stream reportStream = this.ConvertReportToPDF(reportDoc); return new FileStreamResult(reportStream, "application/pdf");

asp.net mvc generate rdlc/Excel to pdf report

You can follow the code: public ActionResult GenerateReport(CustomerPackageReportViewModel CustomerPackageReportViewModel) { List<CustomerPackageDetailsReportViewModel> _customerList = (List<CustomerPackageDetailsReportViewModel>)Session["CustomerPackageInfo"]; DataTable tableObj = new DataTable(); if (_customerList!=null) { tableObj = Converter.ToDataTable(_customerList); } else { tableObj = Converter.ToDataTable(ArchitectureList); } ReportDataSource rds = new ReportDataSource("dsCustomerPackageInfo", tableObj); ReportViewer localReport = new ReportViewer(); localReport.ProcessingMode = ProcessingMode.Local; localReport.LocalReport.ReportPath = Server.MapPath("~/Reports/Billing/rdlc/rptCustomerPackageInfo.rdlc"); localReport.LocalReport.DataSources.Add(rds); // Add datasource here stri

on demand parameter in kendo grid load

On demand event // Bouquet combo change event $('#BooketID').live('change', function () { FillChannelGridByBouquetID(); }); set parameter for grid load /* Load kendo grid by bouquetID*/ function FillChannelGridByBouquetID() { var a = {}; a.BooketID = $("#BooketID option:selected").val(); var mAGrid = $('#CustomerPackageChannelKendoGrid').data('kendoGrid'); mAGrid.dataSource.read(a); } Grid $("#CustomerPackageChannelKendoGrid").kendoGrid({ dataSource: { transport: { read: "ChannelReadByBooketID", }, schema: { model: { fields: { SelectColumn: {type: "boolean"}, ChannelID: { type: "string" }, BooketName: { type: "string" }, ChannelName: { type: &quo

C# Linq left join

See the sample: var customer = (from cus in _billingCommonservice.BillingUnit.CustomerRepository.GetAll() join man in _billingCommonservice.BillingUnit.FunctionRepository.ManagersCustomerValue() on cus.CustomerID equals man.CustomerID // start left join into a from b in a.DefaultIfEmpty(new DJBL_uspGetAllManagerCustomer_Result() ) select new { cus.MobileNo1,b.ActiveStatus });

kendo grid column bindable checkbox is not working

bind your grid check box column field { field: "SelectStatus", width: "10%", template: "<input type='checkbox' #= SelectStatus ? checked='checked':'' # class='chkbx' />" } use the script: // Customer grid check event $(function () { $('#CustomerInfoKendoGrid').on('click', '.chkbx', function () { var checked = $(this).is(':checked'); var grid = $('#CustomerInfoKendoGrid').data().kendoGrid; var dataItem = grid.dataItem($(this).closest('tr')); dataItem.set('SelectStatus', checked); }) })

format kendo grid date column field

I share the script of the grid, Hope it will help you. //start Kendo UI Grid $("#CustomerAccountManageKendoGrid").kendoGrid({ dataSource: { transport: { read: "CustomerAccountManageRead" }, schema: { model: { fields: { CustomerAccountManageID: { type: "string" }, ManagerName: { type: "string" }, CustomerName: { type: "string" }, AssignDate: { type: "date" }, ActiveStatus: { type: "string" }, ActionLink: { type: "string" } } } }, pageSize: 20, serverPaging: false, serverFiltering: false, serverSorting: false }, height: 600, filterable: true, groupable: true, sortable: true, resizable: true, pageable: { refresh: true,

Post Kendo Grid data with model data to Controller in MVC

Your save button: <button type="submit" class="btn btn-mini btn-primary" id="btnAddCustomerAccountManage" name="btnAddCustomerAccountManage" onclick="SaveUserProjectDetails()"> <i class="icon-save bigger-125"></i>Save</button> button click function function SaveUserProjectDetails () { var projectPermissionType = 1; var postUrl; var paramValue; if (projectPermissionType == 1) { var gridData = $("#CustomerInfoKendoGrid").data("kendoGrid").dataSource.data(); // set model data for (var i = 0; i < gridData.length; i++) { gridData[i].ManagerGenInfoID = $("#GEmployeeGenInfoID").val(); gridData[i].AssignDate = $("#AssignDate").val(); } postUrl = '@Url.Content("~/Billing/CustomerAccountManage/GetDepartmentWiseCategoryList")';

html get checkbox value by id

try this: <input id="SelectedCB" type="checkbox" style = "z-index: 99999 !important; margin-top: 0px;" onchange="return getCustomer(this);" /> function getCustomer(ctrl) { if ($('#SelectedCB').is(':checked')) { alert('checked'); } else { alert('Unchecked'); } return false; }

asp.net mvc add & remove item from html table

To add & remove item in HTML table like this image you can like the this: Model: public class StudentDetailsModels { public System.Guid? StudentId { get; set; } public System.String StudentName { get; set; } public System.String StudentFatherName { get; set; } public System.String StudentAddress { get; set; } } public class StudentModels { [Key] public System.Guid? StudentId { get; set; } public System.String StudentName { get; set; } public System.String StudentFatherName { get; set; } public System.String StudentAddress { get; set; } private List<StudentDetailsModels> _studentDetailsList = new List<StudentDetailsModels>(); public List<StudentDetailsModels> StudentDetailsList { get { return _studentDetailsList; } set { _studentDetailsList = value; } } } View: @{ ViewBag.Title = "StudentInfo";