<script type="text/javascript">
function EmailValidation(sender, args) {
var email = $("#TextBoxEmailAddress").val();
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
args.IsValid = re.test(email);
}
</script>
<asp:TextBox ID="TextBoxEmailAddress" runat="server" ClientIDMode="Static"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Invalid email"
ClientValidationFunction="EmailValidation" ControlToValidate="TextBoxEmailAddress"></asp:CustomValidator>
Tuesday, May 1, 2012
Monday, April 30, 2012
Friday, April 27, 2012
Dynamically creating meta tags in asp.net mvc by Html.Raw
http://www.dotnetjalps.com/2012/04/dynamically-creating-meta-tags-in.html
ViewBag.MetaTag = HomeMetaTags();
@Html.Raw(ViewBag.MetaTag)
public string HomeMetaTags(){ System.Text.StringBuilder strMetaTag = new System.Text.StringBuilder(); strMetaTag.AppendFormat(@"<meta content='{0}' name='Keywords'/>","Home Action Keyword"); strMetaTag.AppendFormat(@"<meta content='{0}' name='Descption'/>", "Home Description Keyword"); return strMetaTag.ToString();} @Html.Raw(ViewBag.MetaTag)
Thursday, April 26, 2012
ASP.NET MVC & jQuery UI autocomplete
http://blogs.msdn.com/b/ukadc/archive/2012/04/24/asp-net-mvc-amp-jquery-ui-autocomplete.aspx
public static MvcHtmlString AutocompleteFor<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, string actionName, string controllerName)
{
string autocompleteUrl = UrlHelper.GenerateUrl(null, actionName, controllerName,
null,
html.RouteCollection,
html.ViewContext.RequestContext,
includeImplicitMvcValues: true);
return html.TextBoxFor(expression, new { data_autocomplete_url = autocompleteUrl});
}
public static MvcHtmlString AutocompleteFor<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, string actionName, string controllerName)
{
string autocompleteUrl = UrlHelper.GenerateUrl(null, actionName, controllerName,
null,
html.RouteCollection,
html.ViewContext.RequestContext,
includeImplicitMvcValues: true);
return html.TextBoxFor(expression, new { data_autocomplete_url = autocompleteUrl});
}
Subscribe to:
Posts (Atom)