1
vote
1answer
17 views

CheckBox helper keeps sending false value no matter what's the selection

Here's my code: @using (Html.BeginForm("AddMCondition", "Admin")) { <td class="admin-textbox"> @Html.TextBox("txtMCondition") </td> <td> @foreach (var exerType in ...
1
vote
2answers
25 views

How to create a custom class similar to HtmlHelper and initialize with ViewContext?

Our project uses a lot of custom HtmlHelper extension methods to be referenced in views like: @Html.MyHelperMethod() However, I'd like to keep them separated out from the system ones and be able to ...
1
vote
1answer
36 views

MVC4 DropDownListFor - showing correct result

I have an EDIT view strongly typed to a model that has 2 fields: Name and category. Name is just a string and category is chosen from a dropdown list. My controller: [HttpGet] public ...
1
vote
1answer
150 views

Calling Javascript from HTML Helper

I've written a custom HTMLHelper that outputs some javascript. The javascript is being added to the page but it's not being run when the page loads. If I copy / paste the generated JS into the ...
2
votes
2answers
32 views

Custom Attributes for SelectlistItem in MVC

I would like to create a custom htmlhelper(Extension Method) for dropdownlist to accept custom attributes in the Option tag of the selectlistitem. I have a property in my model class, that I would ...
0
votes
1answer
24 views

Database access in asp.net

I am not very much familiar with razor view engine. I tried this code. @for(var item in ViewBag.list) { @foreach (var itemvote in ViewBag.listVote) { ...
0
votes
1answer
19 views

Custom helper loading an image and that would work as a link

I have made this custom Html Helper: public static MvcHtmlString Image(this HtmlHelper _helper, string _url, string _altText, object _htmlAttributes) { TagBuilder builder = new ...
1
vote
4answers
3k views

Html helper for boolean values in asp.net mvc

Are there any html helper methods for displaying boolean values in a dropdown?
0
votes
2answers
60 views

Single strongly Typed Partial View for two similar classes of different types

I have a Register Primary View which shows two different types of Addresses 1. Home Address 2. Mailing Address public class RegisterModel { public AddressModel ...
0
votes
1answer
33 views

Using a custom Html Helper to make an image as a link: how to pass data in the RouteValueDictionary

I'm using these html helpers: /* * Image Link HTML helper */ /// <summary> /// return image link /// </summary> /// <param ...
0
votes
1answer
21 views

Custom HtmlHelper for a dropdownlist shows all the values as plain text instead of building a dropdownlist

I have tried to build a custom DropDownList using this method here: http://blog.platformular.com/2011/12/16/country-drop-down-html-helper-for-asp-net-mvc/ Basically, the helper loads an Html File, ...
3
votes
3answers
2k views

HTML.HiddenFor value set

@Html.HiddenFor(model => model.title, new { id= "natureOfVisitField", @value = '@Model.title'}) it doesen't work! how to set the value?
1
vote
3answers
188 views

Razor HtmlHelpers with sub-sections?

Is there a way to build the custom Html Helpers and put them into sub-sections? I.e: @Html.Buttons.Gray @Html.Buttons.Blue @Html.Tables.2Columns @Html.Tables.3Columns Thanks.
12
votes
4answers
3k views

Using an MVC HtmlHelper from a WebForm

I'm in the process of adding some UI functionality to a hybrid WebForms/MVC site. In this case, I'm adding some AJAX UI features to a WebForms page (via jQuery), and the data is coming from an MVC ...
0
votes
2answers
21 views

How to use Razor EditorFor Helper to create a TextBox with a value in from ViewBag

I simply want a text box editor field to appear with a value in it that has been passed with a ViewBag for example if ViewBag.Savings contained '6': I tried something like: @Html.EditorFor(model ...

1 2 3 4 5 36
15 30 50 per page