all groups > asp.net building controls > september 2005 >
You're in the

asp.net building controls

group:

About the "Page.RegisterRequiresRaiseEvent and Page.RequiresPostBa


About the "Page.RegisterRequiresRaiseEvent and Page.RequiresPostBa han zhiyang
9/22/2005 6:36:10 AM
asp.net building controls:
I wonder if the Page.RegisterRequiresRaiseEvent and Page.RequiresPostBack are
asp.net bugs,for they are somewhat "ugly" and difficult to use.At the same
time, I wonder if there is other alternatives I can choose.I've read the book
"Developing Microsoft ASP.NET Server Controls and Components" by Nikhil
Kothari, and here is some codes in LoadPostData method in code list 9-11:

bool buttonClicked = (buttonValue != null) && (buttonValue.Length != 0);
if (buttonClicked) Page.RegisterRequiresRaiseEvent(this);

Reading these codes,I feel I go back to the asp times again. these are
somewhat ugly.
Re: About the "Page.RegisterRequiresRaiseEvent and Page.RequiresPostBa Teemu Keiski
9/24/2005 12:00:00 AM
Well,

how would you do it better? Please share as that would ne crucial
information for MS to make the ASP.NET even better.

Personally, I find those methods useful and not so hard to use, especially
thanks to Nikhil's book, but sure everything can always be implemented
better.

That line of code is because implementing IPostBackDataHandler goes over
IPostBackEventhandler when control's implementation is checked (postback
data checked and determined what interface implementation to call) so when
control implements both interfaces, IPostBackEventHandler implementation
must be manually called since framework deals then only with
IPostBackDataHandler

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

[quoted text, click to view]

Re: About the "Page.RegisterRequiresRaiseEvent and Page.RequiresPostBa Teemu Keiski
9/24/2005 12:00:00 AM
And by the way, in ASP.NET v2 their use is not so crucial as Framework is
smarter in calling both event implementations. That's just based on my
tests.

Teemu

[quoted text, click to view]

Re: About the "Page.RegisterRequiresRaiseEvent and Page.RequiresPo han zhiyang
9/25/2005 3:33:03 AM
Thank you very much for your Response.
I read the version1.1 SDK,and tried to use a submit button named with the
UniqueID of my custom control.i had thought the control on server side and
the html tags rendered by it are two different entity,so the asp.net runtime
may find the UniqueID in submited contents and also can find the custom
control with the same UniqueID in the requested page.because the latter has
inherited those two interfaces,so the expected methods could work. but i
failed and don't know why. I've implemented the LoadPostData and
RaisePostBackEvent method according to the instructions in Nikhil's book.It
is really not so difficult to use and works pretty well,although still it
seems not so elegant.
say thank you again.
[quoted text, click to view]
Re: About the "Page.RegisterRequiresRaiseEvent and Page.RequiresPo han zhiyang
9/25/2005 3:58:01 AM
By the way,the submit button is rendered in the custom control's Render method.

[quoted text, click to view]
AddThis Social Bookmark Button