DmitryEfimenko / TwitterBootstrapMvc

Fluent implementation of ASP.NET-MVC HTML helpers for Twitter Bootstrap.
Apache License 2.0
223 stars 79 forks source link

Form TextBox without Label #279

Closed AreebaAroosh closed 10 years ago

AreebaAroosh commented 10 years ago

Using FormGroup().TextBoxFor, how can I generate the textbox without Label?

DmitryEfimenko commented 10 years ago

you can set label's text to be empty. That's won't get rid of the label, but might be good enough for you

AreebaAroosh commented 10 years ago

I tried that, but if the LabelText is set to null or empty string, it displays the model property name.

DmitryEfimenko commented 10 years ago

do you have latest? It should work fine with empty string. Also, if you have latest and it does not work, show me you code

AreebaAroosh commented 10 years ago

It is working.

How to write this using BMVC, (specifying image file for icon)

        <div class="form-group">
           <div class="input-group">
              <span class="input-group-addon">
                 <img src="~/Content/images/key.png" width="14" alt="" />
              </span>
              <input type="password" class="form-control" id="password" name="password" placeholder="Password">
           </div>
        </div>

@(f.FormGroup().PasswordFor(x => x.Password) .Placeholder("Password") .PrependIcon(???????) .Label().LabelText(""))

DmitryEfimenko commented 10 years ago

There is no way to specify to use tag with BMVC. You can create a css rule like

.my-icon {
    backround: url('~/Content/images/key.png')
}

and then use it in BMVC helper: .PrependIcon("my-icon")

DmitryEfimenko commented 10 years ago

I assume this can be closed