Should Html helpers be recategorized?

Last post 09-05-2008 11:08 PM by Eilon. 2 replies.

Sort Posts:

  • Should Html helpers be recategorized?

    09-03-2008, 5:28 AM
    • Member
      point Member
    • dougcook
    • Member since 09-03-2008, 9:17 AM
    • Redmond
    • Posts 1

    The Html helper stuff (can't call it a class since it is mostly extension methods... Stick out tongue) seems to have two modes. In the first mode, you use it like this:

     <%= Html.ReturnSomething(stuff) %>

    In the other mode, you use it like this:

     <% Html.WriteSomething(stuff) %>

    or like this:

    <% using (Html.StartSomething(stuff)) %>morestuff<% } %>

    This has been a source of confusion to myself, and it appears to be confusing to others as well.

    My gut feeling is that the two types of usage should be in two different categories using two different "keywords". I'm not great with keywords, but maybe the methods that return a string should be invoked via "Tag", i.e. Tag.SubmitButton(). Or perhaps the methods that directly write something should change to use a different keyword like "Render", i.e. Render.Form(...).

  • Re: Should Html helpers be recategorized?

    09-03-2008, 2:43 PM
    • Contributor
      4,372 point Contributor
    • tgmdbm
    • Member since 12-17-2007, 2:08 PM
    • Posts 883
    • ASPInsiders
      TrustedFriends-MVPs

    Well, "WriteSomething" always begins with Render, and "StartSomething" is just Form at the moment (I believe).

    But yeah, I'm all for making that distinction clearer.

  • Re: Should Html helpers be recategorized?

    09-05-2008, 11:08 PM
    Answer
    • Contributor
      5,653 point Contributor
    • Eilon
    • Member since 06-26-2002, 6:14 PM
    • Redmond, WA
    • Posts 965

    Thanks for the feedback, guys!

    This is in fact something that we've struggled with before. We've been looking for ways to help reduce the confusion of which syntax to use with which helpers. I'll bring it up with the rest of the team to see if we can clean this up.

    Thanks,

    Eilon

    Blog: http://weblogs.asp.net/LeftSlipper/
Page 1 of 1 (3 items)