Custom Controls

  • Thread starter One Handed Man \( OHM - Terry Burns \)
  • Start date
G

Guest

BTW, here is an excellent and comprehensive reference on the Microsoft MSDN
Library, which you can study in case you haven't downloaded the free .Net
SDK:

http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondevelopingwebformscontrols.asp?frame=true

That is an excellent resource I haven't run across yet, thank you. It clarifies a lot of things. I just have one more question, that isn't even really important to development. Does the NameValueCollection "values" (or whatever you call it) that is a parameter to LoadPostData() contain *all* the key/value pairs for the entire page (entire form), and not just those associated with the control on which the method is called? That's the impression I get from reading the "Composition vs. Rendering" article at:

http://msdn.microsoft.com/library/d.../cpguide/html/cpconcompositionvsrendering.asp

If so, does that mean that in the LoadPostData for, say, MyControl, you could potentially read key/value pairs intended for other controls? Just curious. Thank you for your time.
 
K

Kevin Spencer

Hi Jeff,

Remember that ASP.Net is a means of working with and rendering HTML. If you
understand how HTML works, you've got half of ASP.Net figured out (the easy
half!). A PostBack is simply an HTML form posting itself to the same URL it
came from, and the server-side objects handle the Request. In HTML, a form
posts all form fields contained within it, including hidden form fields. So,
the answer to your very good question is, The PostDataCollection is a
NameValueCollection (object) which is formed by getting all the names and
all the values posted by the form, and putting them into this Collection.
The postDataKey parameter is the name of the form field which caused the
Post. It is obtained by checking the hidden __EventTarget form field which
ASP.Net adds to the form. It uses JavaScript on the client to set the value
of this hidden form field and posting the form. As long as you knew the
client-side name attribute of any form field, you could extract its value by
invoking postCollection["FormFieldName"].

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Jeff Evans said:
clarifies a lot of things. I just have one more question, that isn't even
really important to development. Does the NameValueCollection "values" (or
whatever you call it) that is a parameter to LoadPostData() contain *all*
the key/value pairs for the entire page (entire form), and not just those
associated with the control on which the method is called? That's the
impression I get from reading the "Composition vs. Rendering" article at:
http://msdn.microsoft.com/library/d.../cpguide/html/cpconcompositionvsrendering.asp

If so, does that mean that in the LoadPostData for, say, MyControl, you
could potentially read key/value pairs intended for other controls? Just
curious. Thank you for your time.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,088
Latest member
JeremyMedl

Latest Threads

Top