M
Mark Sisson
Issue:
I want to create a control that will accept a click event and then in
response completely change it's look and feel. This could potentially
mean a new completely new set of child controls than what the control
had previously.
Problem:
The problem is that the click event holds the key in determining what
the new layout will be but don't you have this info when you're in the
CreateChildControls? This happens before the click event!
Example:
I'm working on a navigation control with "<< prev 1 2 3 next >>" look
and feel. This example would have 7 LinkButtons. When the user
presses the #2 link I want the control to get the event, shift it's
numbering to "2 3 4", and potentially change the #2 LinkButton to a
Label or perhaps radically change the look and feel.
Questions:
1. If I want the control to receive the click event do I have to
create my controls in the CreateChildControls event? I've tried moving
the entire control creation to the PreRender but then the wiring of
EventHandlers doesn't work and my link clicks don't work.
2. Should I build the entire raw HTML in the PreRender? Then would I
hookup my own client-side script to post back? Doesn't this defeat all
the magic of ASP.NET?
3. Is there a way to "peak" at the object that caused the event to
fire in the CreateChildControl event? In my example above, all I just
need to know what LinkButton was pressed before I build things in
CreateChildControls. My guess is no. you've probably got to
completely reset the entire f***ing DOM in the Init just so ASP.NET
can match the event with it's firing control. Then you complete scrap
it and rebuild a new control. What a waste of CPU time!!!!
FRUSTRATING!!! WHY IS THIS SO DAMN DIFFICULT!!!!!!!
TIA for you help.
I want to create a control that will accept a click event and then in
response completely change it's look and feel. This could potentially
mean a new completely new set of child controls than what the control
had previously.
Problem:
The problem is that the click event holds the key in determining what
the new layout will be but don't you have this info when you're in the
CreateChildControls? This happens before the click event!
Example:
I'm working on a navigation control with "<< prev 1 2 3 next >>" look
and feel. This example would have 7 LinkButtons. When the user
presses the #2 link I want the control to get the event, shift it's
numbering to "2 3 4", and potentially change the #2 LinkButton to a
Label or perhaps radically change the look and feel.
Questions:
1. If I want the control to receive the click event do I have to
create my controls in the CreateChildControls event? I've tried moving
the entire control creation to the PreRender but then the wiring of
EventHandlers doesn't work and my link clicks don't work.
2. Should I build the entire raw HTML in the PreRender? Then would I
hookup my own client-side script to post back? Doesn't this defeat all
the magic of ASP.NET?
3. Is there a way to "peak" at the object that caused the event to
fire in the CreateChildControl event? In my example above, all I just
need to know what LinkButton was pressed before I build things in
CreateChildControls. My guess is no. you've probably got to
completely reset the entire f***ing DOM in the Init just so ASP.NET
can match the event with it's firing control. Then you complete scrap
it and rebuild a new control. What a waste of CPU time!!!!
FRUSTRATING!!! WHY IS THIS SO DAMN DIFFICULT!!!!!!!
TIA for you help.