PC Review


Reply
Thread Tools Rate Thread

Custom HtmlForm - Major Help Needed!!!

 
 
Roshawn
Guest
Posts: n/a
 
      2nd Feb 2007
Howdy Programmers,

I'm using a custom html form - CHtmlForm @ http://www.codeproject.com/aspnet/CHtmlForm.asp - 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
 
Reply With Quote
 
 
 
 
Roshawn
Guest
Posts: n/a
 
      3rd Feb 2007
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.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Major help needed LiAD Microsoft Excel Misc 2 4th Feb 2010 05:23 PM
major help needed! indiefilmmaker2011@gmail.com Windows XP General 7 4th Apr 2007 12:37 AM
Major Problems: Major Geeks Needed! papacera Windows XP Help 0 11th Nov 2005 04:35 PM
Major help needed =?Utf-8?B?bWlrZV92cg==?= Microsoft Excel Misc 6 19th Apr 2005 12:31 PM
Major help needed!!!! KyDeano Microsoft Excel Discussion 2 21st Oct 2004 07:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:24 PM.