Custom HtmlForm - Major Help Needed!!!

Discussion in 'ASP .Net' started by Roshawn, Feb 2, 2007.

  1. Roshawn

    Roshawn Guest

    Howdy Programmers,

    I'm using a custom html form - CHtmlForm @ - that allows me to use the HTTP
    GET method (that is, I can supply a value for the form's action attribute and it won't be ignored by ASP.NET). Testing it
    shows that it works great.

    Of course, there are a few things I'd like to change, which is why I'm asking for assistance:

    1. I'd like to prevent the form and its server controls from having their ID and Name attributes changed. For example, the
    form's ID is always "aspnetForm" as well as its name. The ID for server controls is set to "ctl00_" and [somename] when it
    should just be [somename]; likewise, the Name attribute is set to "ctl00$" and [somename] when it should just be [somename].

    While I don't really care what ASP.NET does with the ID and Name of the form itself, I sure hate that it makes changes to
    other controls' attributes. The problem reveals itself when using the HTTP GET method. The values of the controls are
    passed in the querystring, but because the controls' Name attributes are changed they are url encoded which makes it
    difficult to access those values using Request.QueryString in code. (Sure I could use Request.Form or something, but hey,
    people want urls they can read and hack easily, not some encoded crap.)

    2. I'd like to render the __VIEWSTATE and __EVENTVALIDATION hidden fields based on the form's Method attribute. If set to
    "GET" these fields should be removed from the page. If set to "POST" or the action attribute contains no value, these fields
    should be rendered on the page.

    My reasons for this are simple: using HTTP GET, this garbage (hidden fields) are passed in the querystring and I'd like to
    get rid of them plain and simple. Having them not show up in the page (by right-clicking the page and selecting View Source)
    makes the page size smaller and spiders don't have to get hung up on reading all the crap contained in them, especially the
    __VIEWSTATE field which could go on forever.

    It may seem like a tall order, but what I want is to have the best of both worlds: the ability to use both HTTP methods
    (especially the GET method) while using server controls without the need for Javascript. I hope you'll agree.

    Thanks for the help,
    Roshawn, Feb 2, 2007
    1. Advertisements

  2. Roshawn

    Roshawn Guest

    Further study reveals that the Page class is responsible for rendering the pesky viewstate
    stuff on the page. Perhaps creating another page class that inherits from the
    TemplateControl and checking the values of my form's attributes is the correct way of
    handling my second issue (see original post) in part.
    Roshawn, Feb 3, 2007
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kokwooi

    Major Major Problem With ASP.NET

    kokwooi, Sep 18, 2003, in forum: ASP .Net
    Sep 19, 2003
  2. Jeff Dockman
    Jeff Dockman
    Nov 17, 2003
  3. Roshawn

    HtmlForm Help...Again

    Roshawn, Feb 2, 2007, in forum: ASP .Net
    Feb 2, 2007
  4. Jef Driesen
    Jef Driesen
    Jan 12, 2006
  5. ara howard
    ara howard
    Oct 28, 2003

Share This Page