Prev | Current Page 186 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

RaisePostDataChangedEvent() is blank, because we
are not emitting events from our control based on state changes, but it still must be present to
satisfy the terms of the interface. In the next chapter, we go further into raising our own events
and examine what kind of code you would normally put into the RaisePostDataChangedEvent().
LoadPostData() has the necessary logic to read the information posted by our type="text"> tag rendered in the HTML document. LoadPostData() uses the passed-in key to
read from the postCollection collection passed into the routine. The type of the collection is
NameValueCollection, so you can expect a string value to be passed back when you access the
data with your key.
Once we pull out the data, we store it immediately in ViewState via the Text property so the
control can remember what was sent to it as well as render the correct HTML for the
tag with the value filled in upon return to the browser. The LoadPostData() routine closes by
returning false, because it does not need to have RaisePostDataChangedEvent() called, as no
events are implemented.
Using the Textbox Control
The Postback Data web form is identical to the previous Label Controls demonstration except
for removal of the ASP.


Pages:
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198