August 7, 2009

free counters


set css class for controls using javascript from code behind

June 10, 2009

string scriptString = "document.getElementById('ctl00_tvMainNavigationn17')";
scriptString += ".setAttribute('className', 'NodeBold');";
scriptString += "document.getElementById('ctl00_tvMainNavigationn18').setAttribute('className', 'NodeBoldClass');";
scriptString += "document.getElementById('ctl00_tvMainNavigationn19').setAttribute('className', 'NodeBoldClass');";
Page.RegisterStartupScript("onload", scriptString);


Call a master page Method() from content page using c#

May 26, 2009

In the Master page code behind file define the method you want to call as Public.

public partial class MasterPage : System.Web.UI.MasterPage
{

public void ShowLicenseErrorImage()
{
this.IMG_LicenseExceedWarn.Visible =
this.lblLicenseMisuse.Visible =
this.lblDetails.Visible = true;
}

public void HideLicenseErrorImage()
{
this.IMG_LicenseExceedWarn.Visible =
this.lblLicenseMisuse.Visible =
this.lblDetails.Visible = false;
}

}

Now in the content page code befind type the following.

MasterPage master = (MasterPage)this.Master;
master.ShowLicenseErrorImage();

Where “MasterPage” is the class name of class in master page.

Thats it!!! :-)


Set culture to your application according to the client’s browser language

April 2, 2009

As a part of globalization of an application we will require to set culture depending on the which language client’s browser is using. And using these culture we should represent date, numbers, currency etc in specific format. For this we can use Request.UserLanguages. Following is a method which returns the code of language which the browser is using. Read the rest of this entry »


Javascript: email address field validation

January 22, 2009

Use the following code
Read the rest of this entry »


Javascript: Numerical Only

January 22, 2009

Use this javascript function to check whether the textbox value is numerical or not

function NumericalOnly() {
var numericalOnly = new RegExp(“^[0-9]*$”)
var textbox = document.getElementById(“TextBox1″).value;
if (!numericalOnly.test(textbox)) {
alert(“Please enter a valid number!”)
}
}

Thanks,
Anil.


Javascript: Validate Date

January 22, 2009

Put this code in the script tag under head tag.
Read the rest of this entry »


Javascript: Remove WhiteSpace

January 22, 2009

Wallpaper Changer

January 14, 2009

You can use the following code to change the desktop wallpaper programmatically. If you want the whole project, then you can download it from this link-
Read the rest of this entry »


Get list of folders inside a sharepoint document library

December 11, 2008

After doing a long search in net, I found a method to get the folder lists inside a document library. It cannot be achieved using a windows sharepoint webservice instead we should use frontpage RPC methods. List documents is one such method that will return the list of folders and documents inside a document library. But the return value will be in the HTML format. So i filtered only the folder names from it. Below i am giving the code snippet. This might be useful for you folks. Read the rest of this entry »