Mar 18th, 2010 | 1 Comment

Following is the code to validate any textbox or input text against html tags.

//source and args are required if calling from custom validator in asp.net else its not required
function htmlValidation(source,args)
{
var re = /(<([^>]+)>)/gi;

if (document.getElementById(’<%=TextBox2.ClientID%>’).value.match(re)) {
document.getElementById(’<%=TextBox2.ClientID%>’).value = “”;
alert(’Invalid content’);
//args.IsValid = false; // you can use this if you are calling this from custom validator in asp.net
return false;
}
if (document.getElementById("textboxid").value.match(re)) {
document.getElementById("textboxid").value = “”;
alert(’Invalid content’);
return false;
}
return true;
}
Jan 6th, 2010 | No Comments

ASP.Net menu controls breaks in Google Chrome and works fine in other browsers. Here is the hack to make it work in Google Chrome as well,

if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
     Request.Browser.Adapters.Clear();

Just add this code on your page load and the menu control will start working fine in Google Chrome as well.

Also some times the hover menus don’t work on IE8 to make it work on IE8 you need to set

“z-index”

in DynamicMenuStyle property of the menu control.

Hope this helps :)