Archive for December 2013
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.
How to hide the first option of a select using jQuery
When using "jquery.selectbox.js" plugin the "select & option" tags will be converted into "ul li" at run time. In this case it's hard to hide the first option using the normal select option script. The following solution rectifies this situation..
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.
Microsoft SQL Server Function to Get Ordinal Suffix of a Number
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 done using String.Format. However it's not really that hard to write a function to.
PHP Code to Get Ordinal Suffix of a Number
It's a user-defined function which is a lot simpler than you think. Though there might be a .NET function already in existence for this, the following function (written in PHP) does the job. It shouldn't be too hard to port it over. This ordinal function.
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,.
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.
How to prevent resizing of TextArea?
We need to disable the re-sizable property of a TextArea. Normally, we can resize a TextArea by clicking on the bottom right corner of the TextArea and dragging the mouse. The following CSS is used to disable this behaviour.
Use the following CSS rule.
How to get current HTML Page Title/URL with jQuery/Javascript?
Get current HTML page Title and URL with jQuery and Javascript.
Current Page Title:
jQuery:
var title = $(document).find("title").text();
(or)
var title = $('title').text();
(or)
var title = $(document).attr('title');
Javascript:
var title.
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.
How to call a WebMethod of a Web Service using jQuery Ajax JSON?
How to call a WebMethod of a Web Service using jQuery Ajax JSON
The following jQuery is used to call a WebMethod of a Web Service using jQuery Ajax JSON.
jQuery:
$(document).ready(function () {
var Name = $("#name").val();
var Email = $("#email").val();
var.
How to find the value of a HTML tag attribute using jQuery?
Note:
When using "jquery.selectbox.js" plugin the "select & option" tags will be converted into "ul li" at run time. The problem is we can not get the selected value using the normal jQuery or Javascript when we use this plugin. The following.
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.
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 =.
How to enable the remote testing of webservice methods in live environment?
Scenario:
The test form is only available for requests from the local machine.
Solution:
For enabling remote web service test page, just add HttpPost/HttpGet protocol in the webServices section of your web.config. By default, this option.
How to resolve “HTTP Error 500.19 - Internal Server Error” on IIS

Error:
HTTP Error 500.19-Internal Server ErrorThe requested page cannot be accessed because the related configuration data for the page is invalid.
Solution:
Step 1:
Start Visual studio command prompt as an administrator as shown in the.
How to find the Document Type Alias of the First Child Node using Razor?
To find the Document Type Alias of the First Child Node using Razor.
@Model.Children.First().NodeTypeAlias.