Wednesday 16 September 2020

Column to row transform in SQL Server

 Q :  In an organization,  staff tasks had been assigned through CRM and task status (New, Complete, Pending) submitted to CRM back. Now Admin want to see the every staff task status New, Compare and pending order with staff name

Table Structure

Wednesday 9 September 2020

Get Date dd/mm/yy format using format string C# | ASP.Net

ASP.Net has reach variety of date processing techniques . If yoo want to date as in dd-mm-yy format then you can use format string which help you to set your date output as you want. Using format string increase your ourput by just a line of code.

DateTime dt = DateTime.Now;

string format = "ddmmyy";

string postfix = dt.ToString(format);    

Output : 110920        

Console.WriteLine(postfix);

You can use different versions of format string as per your requirement . 

string format = "dd-mm-yy";
Output : 09-11-20

string format = "DDD mm yy";
Output : Wed 09 20

Format string pattern

M display one-digit month number d display one-digit day of the month h display one-digit hour on 12-hour scale mm display two-digit minutes yy display two-digit year

Saturday 5 September 2020

Bind dynamic layout on a single view using C# | ASP.Net

 

ASP.Net MVC is a popular platform to design dynamic website and CRM etc. One I was stuck in a situation when I want to use a common view to different privileged users. So I had to bind multiple layouts on a single view as per the related users menu or sidebar. This post will help you to bind dynamic layouts on a single view.

  public ActionResult Task()

        {

File Resizing C# | ASP.NET | MVC

 

You can resize your image as per your requirement by using WebImage Class which implemented in System.Web.Helpers namespace and resizing is done by Resize and save method.

Namespace : using System.Web.Helpers;

[HttpPost]

        public JsonResult UploadCommonImage(string fnm, string pth,string w,string h)

        {