private static ControlLabel <MvcBootstrapHelper <TModel> > GetControlLabel <TModel, TValue>(IComponentCreator <MvcBootstrapHelper <TModel> > creator, Expression <Func <TModel, TValue> > expression) { string htmlFieldName = ExpressionHelper.GetExpressionText(expression); ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, creator.GetHelper().HtmlHelper.ViewData); string text = metadata.DisplayName; if (text == null) { text = metadata.PropertyName; if (text == null) { char[] chrArray = new char[] { '.' }; text = htmlFieldName.Split(chrArray).Last <string>(); } } return(new ControlLabel <MvcBootstrapHelper <TModel> >(creator, text).For(TagBuilder.CreateSanitizedId( creator.GetHelper().HtmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(htmlFieldName)))); }