Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:03:39+00:00 2026-06-14T12:03:39+00:00

For example when using a @Html.TextBoxFor(v => Model.Text); and submitting the form, the value

  • 0

For example when using a

@Html.TextBoxFor(v => Model.Text);

and submitting the form, the value in the TextBox is automatically assigned to Model.Text.

I want to write such a custom HTML helper.

I know how to write such a extension method for displaying HTML, but how to program the behaviour to assign the value Model.WhatEver.

I want to build a Tag-Cloud and I think it is a good idea to include it in a way like:

@Html.TagCloud(v => Model.SelectedTags, Model.AvailableTags)

The HTML-Helper just prints out HTML, but how can I assign values to Model.SelectedTags?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:03:41+00:00Added an answer on June 14, 2026 at 12:03 pm

    See how this method is defined:

    public static MvcHtmlString TextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression);
    

    It is just generic extension method in static class returning MvcHtmlString. Just write one yourself and insert it into view via web.config.

    <pages>
      <namespaces>
        <add namespace="NameSpaceWithYourClass" />
    

    Remeber that this method have to take this HtmlHelper<TModel> as extension parameter and
    Expression<Func<TModel, TProperty>> expression as expression for selecting property and you will be fine.

    BTW: i think for your need would be better partial view since HTML for it can be quite complicated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using @Html.TextBoxFor(m => m.MyField) will (normally?) result in <input id=MyField name=MyField type=text value= />
I have two text boxes: A and B using Html.textboxfor . TextBox 'A' is
I have a form containing a date and datetime field: @Html.TextBoxFor(model => model.A, new
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
Question How do I remove class attributes from html using python and lxml? Example
I follow example from here using section listview http://lalit3686.blogspot.com/2012/05/sectionadapter.html But how can I implement
I am learning knokcout.js I was using the example in http://www.knockmeout.net/2011/04/utility-functions-in-knockoutjs.html , which is
I'm using BalusC's FileServlet example: http://balusc.blogspot.com/2007/07/fileservlet.html I'm able to get it to work, however,
I am using the jQuery spinner tool found here: http://btburnett.com/spinner/example/example.html When I try using
I'm using Sass (.scss) for my current project. Following example: HTML <div class=container desc>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.