Skip to content

Bootstrap-MVC #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Bootstrap-MVC #5

wants to merge 6 commits into from

Conversation

gazk
Copy link

@gazk gazk commented May 8, 2012

I was just going to send the html helpers but I have also included the other commits aswell as the T4 templates have been updated to use these new helpers.

There are some new editor templates (@Html.EditorFor) found under Views\Shared\EditorTemplates. The DateTime template will generate a jquery calendar picker. The string template checks the StringLength attribute and changes the size of the text box to fit.

There is a new HelperText attribute which will generate a @Html.BootstrapFormHelpTextBlockFor (maps to a Bootstrap "help-block")

Example model :-

[Required]
[StringLength(20)]
[HelperText("Some helper text")]
[Display(Name = "Forename")]
public string FirstName { get; set; }

[Required]
[DataType(DataType.Date)]
[Display(Name = "Start Date")]
public DateTime? StartDate { get; set; }

The jquery calendar is using a twitter bootstrap theme. The bootstrap-datepicker-format.js file is currently set to dd/mm/yyyy format. Its simple to change to support other formats.

There is a new datatables (http://datatables.net) template called List-DataTables.tt. The original List.tt file still exists as an alternative.

The validation has been changed to use the bootstrap class names rather than copying the css into the equivalent asp.net mvc css classes. This is just to make maintenance easier when upgrading bootstrap. The labels also change colour when validation fails.

Anyway if you just want the extensions then that is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant