Home > C#

Alphanumeric Sort Using PadNumbers

Problem Statement: Sort the Alphanumeric values Solution : below is the Code that helped to sort the alphanumeric values Example : you have the list var List = {a1,ba3,aa2,a2,ba2,aa3}; we can not sort this directly using [crayon-62ba317f3045d016764327/] so to sort this we need to PadNumbers to value and then sort the List. with the help

This Article is TAGGED in , , . Read more

Backup and restore SQL Database to Azure Blob Storage Service in C#

Microsoft Azure Blob Storage is a scalable, online cloud data storage service that stores data blobs in containers. This article helps you understand how to write backups to and restore from the Azure Blob Storage Service and to do so we will create an Azure Blob Container, credentials for accessing the

This Article is TAGGED in , , , , , . Read more

Get access token to call Microsoft Azure api

We require Realm URL, Client ID, Client Secret. Using above key we can fetch the access token as follows.   var realm = "RealmURL"; var authContext = new AuthenticationContext("AuthURL"); var userCreds = new ClientCredential("ClientId", "ClientSecret"); authenticationResult = authContext.AcquireTokenAsync(realm, userCreds).Result; if (authenticationResult != null && !string.IsNullOrEmpty(authenticationResult.AccessToken)) accessToken = authenticationResult.AccessToken;  

This Article is TAGGED in . Read more

Format of data from controller to set different colors for each column in highcharts

If there is case where it is necessary to distinguish data based on color e.g if data is below specified number it should be in red color and above it in green color. In that case data to the highcharts should be with color code. [crayon-62ba317f30db5880783050/] In method getColor1(int a), you can

This Article is TAGGED in , . Read more

MaxJsonLength exception in ASP.NET MVC during JavaScriptSerializer

Problem Statement:  The following exception (error) occurs in ASP.NET when AJAX calls are made to PageMethod using jQuery AJAX or ScriptManager Error during serialization or deserialization using the JSON JavaScriptSerializer. "The length of the string exceeds the value set on the maxJsonLength property." Below code that helped to resolve the issue. Instead of

This Article is TAGGED in , . Read more

Auto refresh charts using highcharts.js

Highcharts is a pure JavaScript based charting library meant to enhance web applications by adding interactive charting capability. Highcharts provides a wide variety of charts. For example, line charts, spline charts, area charts, bar charts, pie charts and so on. So there may be need of drawing chart with updated data

This Article is TAGGED in , , . Read more

How to get client machine datetime with local timezone offset value

This article will help to understand how to get  client machine's datetime with local timezone offset value. Use javascript method getTimezoneOffset() and assign it's value to hidden field in .cshtml file as shown in below code. Then pass this value to mvc controller. [crayon-62ba317f31532239227696/] In the above code, variable offset will have the

This Article is TAGGED in , . Read more