master pages, form pages, form runat=server > all onclick methods on master page?

Posted by b0x0rz on Stack Overflow See other posts from Stack Overflow or by b0x0rz
Published on 2010-05-22T21:38:18Z Indexed on 2010/05/22 21:40 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

the problem i have is that i have multiple nested master pages:

level 1: global (header, footer, login, navigation, etc...)

level 2: specific (search pages, account pages, etc...)

level 3: the page itself

now, since only one form can have runat=server, i put the form at global page (so i can handle things like login, feedback, etc...).

now with this solution i'd have to also put the for example level 3 (see above) methods, such as search also on the level 1 master page, but this will lead to this page being heavy (for development) with code from all places, even those that are used on a single page only (change email form for example).

is there any way to delegate such methods (for example: ChangeEMail) from level 1 (global masterpage) to level 3 (the single page itself).

to be even more clear: i want to NOT have to have the method ChangeEMail on the global master page code behind, but would like to 'MOVE' it somehow to the only page that will actually use it. the reason why it currently has to be on the global master is that global master has form runat=server and there can be only one of those per aspx page.

this way it will be easier (more logical) to structure the code.

thnx (hope i explained it correctly)

have searched but did not find any general info on handling this case, usualy the answer is: have all the methods on the master page, but i don't like it. so ANY way of moving it to the specific page would be awesome. thnx

© Stack Overflow or respective owner

Related posts about c#

Related posts about methods