There are various cases in which you may want to display results from aggregate functions (Sum, Avg, Count, Min, Max) performed over the columns in the grid in their footer. This post explains how to display aggregate functions in ASP.NET MVC Razor views.
Used Environment for this post: VS 2015 Update 3, ASP.NET MVC 5
For ASP.NET Web Forms, Read following post:
Displaying Total in ASP.NET Gridview Footer Row Without using Template Field
Generally, User submitted images (profile pictures, social media posts, and business documents) are needed to be moderated to protect business and quality. If a large number of images are submitted in an application then manual moderation is time consuming and is not instantaneous. This post explains how to automate image moderation using Azure functions and Cognitive Services. Automated moderation applies machine learning and AI to cost-effectively moderate at scale, without human involvement.
On a web page or application form, it is common to have different master data like Country, State…etc. available in dropdownlist, listbox or any other control. It is needed to read all master data from database and bind to proper controls. This post explains different ways to read master tables with C# and Dapper.
Error: column "Gender" is of type enum but expression is of type text.
Are you getting this error when you are using enum datatype in PostgreSQL database? This blog post explains how to fix the error with C# and Dapper. The following environment is used for this post:
If you are working to integrate your C# application with Microsoft Dynamics CRM, You might need to get the Entity Column List. This article explains how to get the list of entity columns from CRM in C# application.
You need to download the Microsoft Dynamics CRM SDK package and install it, the installation process will extract sdk files and folders.
In this article, we will see different ways to export data to Excel from a web application. It is very common task for web developers. Here are different approaches to do it in ASP.NET – C#:
Using the Excel PIA (primary interop assemblies) to generate a spreadsheet server-side.
It needs Microsoft Office suite installed on your server which is not good. So it is NOT recommended.
Before we get started, let us see the general way to use Session in ASP.NET
if (Session["UserName"] == null)
LabelUserName.Text = "Anonymous";
LabelUserName.Text = (string)Session["UserName"];
You can feel some drawbacks e.g. to check null reference, type safety, to cast object..etc.
Now add following class and see how it solves the issues:
Do you want to import csv or excel (xls, xlsx) file in MongoDB? You can read the file, get the data in C# datatable and save it to MongoDB using InsertBatch method. This article explains how to save C# DataTable to MongoDB for inserting a large amount of data.
To install Official .NET driver for MongoDB, run the following command in the Package Manager Console
To read CSV file doesn’t mean to use String.Split(). CSV files may contain commas, carriage returns, speechmarks…etc within strings. In this post, we will learn how to upload and read CSV File in ASP.NET MVC WITHOUT using Jet/ACE OLEDB provider. It is helpful when you have to deploy your code on shared hosting, Azure website or any server where ACE Database engine is not available. We will use a fast CSV Reader by Sebastien Lorien.
Read Also: Upload and Read Excel File (.xls, .xlsx) in ASP.NET MVC.
Are you using traditional way to read .xls and .xlsx files in ASP.NET/C#? If yes, you might be using following providers:
Microsoft.Jet.OLEDB.4.0 provider for Excel 97-2003 format (.xls)
Microsoft.ACE.OLEDB.12.0 provider for Excel 2007+ format (.xlsx)
and you may get the following common errors:
The ‘Microsoft.Jet.OLEDB.4.0’ provider is not registered on the local machine.
The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine.
and probably, you would go for following approach to fix them
1. Installation of Office 2007 Data Connectivity Components or Office 2010 Database Engine on the Server.
2. The application pool that the site is running set “Enable 32-bit applications” to “True”
3. In project, Change Platform target from: Any CPU to x86 and Rebuild it.
What would happen if you have shared hosting or Azure Website hosting and You are not allowed to install ACE Database engine on the server?
A Responsive Web Design is not only UI changes but also to optimize server side logic for performance. Suppose you are displaying bulk data in desktop environment. But if same data are sent to mobile device, it will make website too slow even the layout is made adaptive on client side. To implement server side logic, we need client side information like browser width and height. In this article, we will implement to get browser height and width on server side in ASP.NET.
Facebook home page displays a collage of random profile photos which makes it something special. So I decided to implement the same thing in ASP.NET. In this tutorial, we will do following things:
1. To get random image names from database using Entity Framework Database First approach.
2. Calculate the total needed images for a given width and height. Assuming all profile images have same size.
3. Combine multiple images into collage using C# graphics
4. Add borders to differentiate images
5. Create linear horizontal opacity gradient for the collage and add it in a page similar to Facebook.
This post is in reply of this thread of the official ASP.NET forum.
The input data is in following format:
|S.no|| Name|| wages|
|1|| Tom|| $200|
|1|| Tom|| $300|
|1|| Tom|| $400|
|2|| Rob|| $500|
|2|| Rob|| $600|
In this post, we will add JSON data to Sql Server tables using ASP.NET Web API, JSON.NET and SqlBulkCopy. The data is posted using jQuery ajax to web api which accepts JObject type argument, parse data, arrange data in the required table structure and save to database. Here is the structure of JSON and SQL Server tables.