Showing posts with label C#. Show all posts

Generic Handler to Unpublish Past Events in Umbraco

The following Generic Handler (C#) is used to unpublish the past/old Events automatically after it's expiration date in Umbraco. Source Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Configuration; using.
Thursday, 7 August 2014
Posted by Jebastin

How to Use CDATA in XML?

All text in an XML document will be parsed by the parser. But text inside a CDATA section will be ignored by the parser. XML parsers normally parse all the text in an XML document. When an XML element is parsed, the text between the XML tags is also.
Posted by Jebastin
Tag : ,

C# Code to implement Google Analytics Tracking Script dynamically

In general we track a page using JavaScript statically. This C# code is used to implement Google Analytics Tracking Script dynamically for every page we want to do it. Source Code: using System; using System.Collections.Generic; using System.Configuration; using.
Posted by Jebastin

Working with Session in ASP.NET

Usage of Session in ASP.NET using C# or jQuery. A session is a piece of data which is sent from a website and stored locally by the user’s browser. Sessions are needed because HTTP is stateless. This means that HTTP itself has no way to keep track of.
Wednesday, 29 January 2014
Posted by Jebastin

How to upload file using jQuery/Ajax?

The following AJAX File Upload jQuery Tutorial covers how to upload files asynchronously using jQuery Framework. Generic Handler: AjaxFileUploader.ashx public class AjaxFileUploader : IHttpHandler { public void ProcessRequest(HttpContext context) {    .
Tuesday, 21 January 2014
Posted by Jebastin

How to convert the first character of a string into upper case?

The following C# code is used to convert the first character of a string into upper case. static string UppercaseFirst(string s) { // Check for empty string. if (string.IsNullOrEmpty(s)) {     return string.Empty; } // Return char and.
Tuesday, 7 January 2014
Posted by Jebastin
Tag :

How to convert all first letters of a sentence into upper case and rest of the letters into lower case?

The following C# code is used to convert all first letters of a sentence into upper case and rest of the letters into lower case. string s = "THIS IS MY TEXT RIGHT NOW"; s = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(s.ToLower()); //.
Posted by Jebastin
Tag :

How to get the URL of the current page

The following code is used to get the URL of the current page. string url = HttpContext.Current.Request.Url.AbsoluteUri; // http://localhost:1302/TESTERS/Default6.aspx string path = HttpContext.Current.Request.Url.AbsolutePath; // /TESTERS/Default6.aspx string.
Saturday, 4 January 2014
Posted by Jebastin
Tag :

How to detect Mobile Device Browsers?

We can easily detect the Mobile device browsers using the following C# code. public bool IsMobileDevice(string UserAgent) {     bool result = false;     Regex b = new Regex(@"(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge.
Monday, 30 December 2013
Posted by Jebastin
Tag :

Find the Distance between 2 Latitude Longitude Co-Ordinates using Haversine formula

The following function is used to find the distance between two Latitude & Longitude co-ordinates using Haversine formula. The haversine formula is an equation important in navigation, giving great-circle distances between two points on a sphere.
Friday, 20 December 2013
Posted by Jebastin
Tag : ,

C# Code to Get the Latitude and Longitude Co-Ordinates of a Place using Address or Zip-code

The following C# Code is used to get the Latitude and Longitude Co-Ordinates of a particular place anywhere in the World using the Address or Zip-code. To get the Latitude and Longitude Co-Ordinates using Address, call the function like this, getLatLong("Briarwood,.
Thursday, 19 December 2013
Posted by Jebastin
Tag : ,

C# Code to Get Ordinal Suffix of a Number

There is no inbuilt capability in the .NET Base Class Library to get the Ordinals. This AddOrdinal function will be useful when we needed to display the date format as 1st July -3rd October. There is nothing in there about ordinals, but it can't be.
Posted by Jebastin
Tag : ,

Web Service to filter the Umbraco Nodes

Web Service to filter the Umbraco Nodes The following WebMethod is used to filter the Umbraco child nodes of a particular parent node using the given parent id by the parameters Keyword, Job Type, Position, Location, Category and Division. Web Method: public.
Saturday, 14 December 2013
Posted by Jebastin

How to insert values in SQL Server database table using Umbraco?

Required Namespaces: using umbraco; using umbraco.BusinessLogic; using umbraco.DataLayer; C# Code: public bool InsertData(string FirstName, string LastName, string Email, string Phone) { bool IsSuccessful = false; try { string InsertQuery = "INSERT.
Posted by Jebastin

How to send email using SMTP in ASP.Net / C#?

C#: public bool Send_Email(string Subject, string Body, string ToEmail, string AttachmentUrl) { bool Sent = false; try { if (!string.IsNullOrEmpty(ToEmail)) { string FromEmail = "", Username = "", Password = "", Host = "", Port = ""; FromEmail =.
Posted by Jebastin

Link To This Post/Page

Spread The Word

Add this button to your blog:
JJ Technology Solutions

Blog Archive

Trackers

eXTReMe Tracker
facebook

- Copyright © 2025 JJ Technology Solutions - Powered by Source Code Solutions -