Wednesday, May 14, 2008

Disable Dates in a Calendar

From my previous experiences , what i have found out is that sometimes we need to disable the previous and coming dates in a calendar control. So finally i thought to post it out. It goes like this....,



protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date< DateTime.Today)
{
e.Day.IsSelectable = false;
e.Cell.ToolTip = "This date is not available";
}
else if (e.Day.Date> DateTime.Today)
{
e.Day.IsSelectable = false;
e.Cell.ToolTip = "This date is not available";
}
}

Keep rockiin........

Wednesday, May 7, 2008

Detecting User's IP Address

If your website contains sensitive data and you don't want any spamming or any malicious use of your website ,then one thing you can do is to keep a track of the visiting user's system IP and this can be done in some easy steps given below,


string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();


Now set the value of clientIPAddress to either a Textbox or label or any control as per your requirement.

Sunday, May 4, 2008

Useful HTML Meta Tags

To be precise, HTML Meta tags are quite powerful in the sense that using these tags one set the page refresh at a specific time and also can put your website at the top level when someone searches (*using Google Search or any other Search engine) for a specific thing related to your website..

Have a look at it and feel the difference.. Hope this helps..

http://www.i18nguy.com/markup/metatags.html


Happy Programming :)