html-helper

asp.net-mvc html helper library

There seems to be an abundance of jQuery plugins that you can grab and use quite easily. Does anyone know of any html helper samples, examples or libraries that you can also download and use. In particular I'm looking for free helpers. :) I know helpers can be specific to applications but it'd be great to see what others are doing. ...

What HTML helper do I use to create a simple dropdownlist that doesn't take in any variables?

I want to have a simple select->option dropdown list that I am not passing any (SelectItem collection) values to. I already know the values so I don't need to do all that (they are static). Need to do something like so: <select id="day" name="day"> <option value="1">Sunday</option> <option value="2">Monday</option> </select> <sel...

ASP.NET MVC Html.Element ?

Is there a generic Html.Element? I would like to be able to do this: Html.Element<AccountController>("IFrame", "elementName", new { src = c => c.ChangePassword }) ...

Boolean with html helper Hidden and HiddenFor

What's up with this? The viewmodel variable is a bool with value true. <%= Html.HiddenFor(m => m.TheBool) %> <%= Html.Hidden("IsTimeExpanded",Model.TheBool) %> <input type="hidden" value="<%=Model.TheBool%>" name="TheBool" id="TheBool"> Results in: <input id="TheBool" name="TheBool" value="False" type="hidden"> <input id="TheBool" na...

Formula in all cells in a column

Hi, Simple question: I want to create a formula which, in column Cn, will compute the values of An * Bn. example column C1 = column A1 * column B1 column C2 = column A2 * column B2 column C3 = column A3 * column B3 ...etc all the way down to column Cn = column An * column Bn Thanks ...

How do you add a boolean attribute in asp.net mvc?

I'm trying to output the following html using an html helper in asp.net mvc 2: <input type="text" id="Name" name="Name" value="" autofocus /> I'm using this code now: <%= Html.TextBoxFor(x => x.Name) %> and I've tried // results in <input ... autofocus="" /> <%= Html.TextBoxFor(x => x.Email, new { autofocus="" }) %> // does not c...

breaking datetime into constituent parts ASP.NET MVC form

hi guys, i have searched the web relentlessly for this and have not found anything - which is surprising because i would think it is such a common scenario! Basically, on my model i have a DateTime field which i wish the user to populate through a form. I am using the Html helper to render all other parts of the form (along with valida...

ASP.NET MVC 2 - How can I get the selected value from a drop down into my view model?

I'm creating a drop down via <%= Html.DropDownList("data.Language", Model.LanguageOptions) %> and want to read back its value through automatic model binding into my LanguageModel viewmodel: public ActionResult Save(LanguageModel data) However, data.Language is null when the Save method is called. How do I get the selected value f...

Convert my List<Roomtype> to SelectList for ASP. NET MVC DropDownFor<>, and get the correct values per option item

I have my class RoomType: Int32 Id String Name String ColorCode My viewmodel gets a List<Roomtype> RoomTypes which should be displayed in a dropdown. Each dropdown option item should have: 1) as title the Name, 2) as value the Id, and 3) the style background-color #ColorCode. My problems are how to convert this list correctly into ...

using partials in view helpers

Creating custom Zend View helpers I often end up with something like: // logic here if ($condition) { $output = <<<EOS... } else { $output = <<<EOS... } or using switch. Then to eliminate this, I create setPartial(), getPartial() and htmlize() for using external .phtml's. This is not the best solution, because partials do no...

html.checkbox - explicit value to hidden field value

Hi I am creating list of checkboxes in partial view by follwoing http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/ code and Rendered HTML for checkboxes is as follows <%=Html.CheckBox("EmployeeID", new { value = user.EmployeeID, @class = "ccboxes", title = user.Designation + "(" + user.Empl...

How to display an explicit message with Html.LabelFor() as merely the name of the model's property

Hello, With ASP.NET MVC 1.0, we could write something like: <label for = "FirstName">First Name:</label> Which displays "First Name:" on screen. Now, with ASP.NET MVC 2.0, we have <% = Html.LabelFor(model => model>FirstName)%> Which displays "FirstName" on the screen. It looks to me a little odd to display things like FirstName, L...

Creating Zend_Form elements from row html

Hi there, I am having an issue with Zend_Form and your help will be appreciated. in fact I have a class to generate categories as options $categories = My_Util_Category::toHtmlSelect();//for simplicity I removed other lines this code generates <select> <option > root</option> <option> root / children</option> </select> On ...

How can I create links for my website?

Hi guys! I'm trying to make a little side-bar menu so people can access area of the web application. Here is what I have so far: <ul id="navi"> <li><img src="../../Content/inicio.png" alt="Inicio" /></a></li> <li><img src="../../Content/evaluaciones.png" alt="Evaluaciones" /></a></li> <l...

MVC2 Html Helpers

I generated a View using VS 2010 functionality. This auto code generation created this code: <%: Html.TextBoxFor(model => model.DateDeleted, String.Format("{0:g}", Model.DateDeleted)) %> I created a custom helper method (extension method) to create a JQuery Calendar control. This is the syntax for this control on the View: ...

Rails View Helper Not Inserting HTML into Page

I'm having an issue using a custom helper method in my Rails (3.0) app to output the required html. I have the following call in my partial view: _label.html.erb <% display_resource "Diamond", @resource.diamond %> And in the resource_helper.rb file: module ResourceHelper def display_resource(display_name, value) "<tr><td>...

Problem binding selected value to DropDownListFor inside Editor Template

Description I have a payment page that includes a form for entering bank account information. I have encapsulated the bank account information into a Model / Editor Template. The page itself has its own View Model, which happens to contain a BankAccount property to be passed in to the Editor. [[View Models]] public class PaymentPageMo...