Skip to content
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

Changes to "Div()" #404

Open
AlonCG opened this issue Nov 16, 2015 · 2 comments
Open

Changes to "Div()" #404

AlonCG opened this issue Nov 16, 2015 · 2 comments

Comments

@AlonCG
Copy link

AlonCG commented Nov 16, 2015

In the latest release ... 3.16.4 ... there are the following changes related to the "Div()" method:

  1. .Div() method now has extensions to specify its offset. Ex: .XsOffset(5)
  2. .Div() method now accepts a string as a parameter

Regarding item 2 above, can you explain what string is to be put as the parameter? My calls to ".Div()" now break, so I put in an empty string ("") for now, but would like to know what should actually go there.

Thanks! All the best.

@AlonCG
Copy link
Author

AlonCG commented Nov 16, 2015

Maybe I am using "Div()" incorrectly ...

@Html.Bootstrap().Div().HtmlAttributes(new { style = "margin-top:5px;" })

I need to see why I was doing that in the first place, but it just looks like I had a placeholder "Div" to add some spacing (inside a tabs.BeginPanel()) ... This may be a moot issue.

@DmitryEfimenko
Copy link
Owner

I'm surprised @Html.Bootstrap().Div() worked before! The intend for the helper method is to wrap any content you like. Before it only used to take IHtmlString, so you could write the following:

@Html.Bootstrap().Div(Html.Bootstrap().TextBoxFor(m => m,UserName))

... and that would output:

<div>
    <input type="text" name="UserName" [and all the rest attrs] />
</div>

In that particular example there isn't much benefit of using .Div(), but it's got Bootstrap related extensions and other BMVC methods that you are used to (I'm sure you are aware of these since you used one in your example).
Now you can pass in any string. Could be Html string or just text:

@Html.Bootstrap().Div("<div>any html here</div>").Sm(3)
@Html.Bootstrap().Div("any text here").Sm(4)

I could add an override that does not take any parameters and outputs an empty div - just like you used to use it. Let me know if you'd like that be done.

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

No branches or pull requests

2 participants