Giter Site home page Giter Site logo

Comments (4)

roryprimrose avatar roryprimrose commented on July 19, 2024

I added the following extension methods to get it to compile (haven't tested yet though).

    public static MvcHtmlString Label(this HtmlHelper html, string expression, string labelText, object htmlAttributes)
    {
        return LabelHelper(html, ModelMetadata.FromStringExpression(expression, html.ViewData), expression, labelText, htmlAttributes);
    }

    private static MvcHtmlString LabelHelper(
        HtmlHelper html, 
        ModelMetadata metadata, 
        string htmlFieldName, 
        string labelText = null, 
        object htmlAttributes = null)
    {
        string str = labelText ?? (metadata.DisplayName ?? (metadata.PropertyName ?? htmlFieldName.Split(
            new[]
            {
                '.'
            }).Last()));

        if (string.IsNullOrEmpty(str))
        {
            return MvcHtmlString.Empty;
        }

        TagBuilder tagBuilder = new TagBuilder("label");
        tagBuilder.Attributes.Add(
            "for", 
            TagBuilder.CreateSanitizedId(html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(htmlFieldName)));
        tagBuilder.SetInnerText(str);

        RouteValueDictionary attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);

        tagBuilder.MergeAttributes(attributes);
        return tagBuilder.ToMvcHtmlString(TagRenderMode.Normal);
    }

from twitter.bootstrap.mvc.

erichexter avatar erichexter commented on July 19, 2024

I am not able to reproduce this.. Can you give me some more details of how
you did this.

The steps I followed were:

  1. open vs2012
  2. create a new mvc 4 - Empty project
  3. in nuget console window: install-package twitter.bootstrap.mv4
  4. in nuget console window: install-package
    twitter.bootstrap.mvc4.sample
  5. F5 build and Debug.

from twitter.bootstrap.mvc.

roryprimrose avatar roryprimrose commented on July 19, 2024

Solved. I did as you suggested and then compared the assembly references. Looks like I had an MVC3 binary being resolved from somewhere. VS had a hint path to a nuget package that no longer existed. The web.config under Views was also pointing to MVC3 and there were MVC3 assemblies being brought in via the root web.config.

I’ve added the MVC4 nuget package, updated the config files and it is all fixed up now.

Thanks

From: Eric Hexter
Sent: ‎24‎ ‎November‎ ‎2012 ‎2‎:‎45‎ ‎AM
To: erichexter/twitter.bootstrap.mvc
CC: Rory Primrose
Subject: Re: [twitter.bootstrap.mvc] Create.cshtml fails build (#12)

I am not able to reproduce this.. Can you give me some more details of how
you did this.

The steps I followed were:

  1. open vs2012
  2. create a new mvc 4 - Empty project
  3. in nuget console window: install-package twitter.bootstrap.mv4
  4. in nuget console window: install-package
    twitter.bootstrap.mvc4.sample
  5. F5 build and Debug.


Reply to this email directly or view it on GitHubhttps://github.com//issues/12#issuecomment-10663069.

from twitter.bootstrap.mvc.

erichexter avatar erichexter commented on July 19, 2024

glad you got it resolved..

from twitter.bootstrap.mvc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.