Event Management Solutions
-
I am writing a Rendered Custom Control that will serve as a multiple page index for our application (similar to the standard next/previous buttons, with specific page links in between). The problem I'm having is that the control is going to be used on pages that render their own dynamic controls (links, etc) to other pages that come out of the database. When the control is rendered, the links on the parent page are not registered properly because the parent page needs to load it's links in the Page_Load method, whereas the multi-page control cannot tell the parent which items to load until the page has responded to its Click event - AFTER the Page_Load has long since finished processing. Is there anyway to register dynamic events on controls prior to rendering but after Page_Load, or conversely does anyone have a suggestion for storing the desired page information on the client so that it's retrievable at Postback? I've tried a hidden text box on the page, but since the text is rendered, I can't add it to the page's control collection and can't figure out how to get at it's data. I also tried using a hidden text box control in my multi-page controls CreateChildControls() method, but could never find the control after postback. This is moderately urgent - any help is GREATLY appreciated.
-
I am writing a Rendered Custom Control that will serve as a multiple page index for our application (similar to the standard next/previous buttons, with specific page links in between). The problem I'm having is that the control is going to be used on pages that render their own dynamic controls (links, etc) to other pages that come out of the database. When the control is rendered, the links on the parent page are not registered properly because the parent page needs to load it's links in the Page_Load method, whereas the multi-page control cannot tell the parent which items to load until the page has responded to its Click event - AFTER the Page_Load has long since finished processing. Is there anyway to register dynamic events on controls prior to rendering but after Page_Load, or conversely does anyone have a suggestion for storing the desired page information on the client so that it's retrievable at Postback? I've tried a hidden text box on the page, but since the text is rendered, I can't add it to the page's control collection and can't figure out how to get at it's data. I also tried using a hidden text box control in my multi-page controls CreateChildControls() method, but could never find the control after postback. This is moderately urgent - any help is GREATLY appreciated.
Kerry MacLean wrote: Is there anyway to register dynamic events on controls prior to rendering but after Page_Load You would do it the same way it's done inside the InitializeComponent method. Kerry MacLean wrote: I've tried a hidden text box on the page, but since the text is rendered, I can't add it to the page's control collection and can't figure out how to get at it's data. Use
Request["nameOfHiddenInputField"]
to get its data. Kerry MacLean wrote: I also tried using a hidden text box control in my multi-page controls CreateChildControls() method, but could never find the control after postback. If you go this route, remember to overrideOnInit
and callEnsureChildControls()
in there. Regards, Alvaro
-
Kerry MacLean wrote: Is there anyway to register dynamic events on controls prior to rendering but after Page_Load You would do it the same way it's done inside the InitializeComponent method. Kerry MacLean wrote: I've tried a hidden text box on the page, but since the text is rendered, I can't add it to the page's control collection and can't figure out how to get at it's data. Use
Request["nameOfHiddenInputField"]
to get its data. Kerry MacLean wrote: I also tried using a hidden text box control in my multi-page controls CreateChildControls() method, but could never find the control after postback. If you go this route, remember to overrideOnInit
and callEnsureChildControls()
in there. Regards, Alvaro
Thanks for the quick response! Alvaro Mendez wrote: You would do it the same way it's done inside the InitializeComponent method. Not sure what you mean here. All of my control output is taking place in the Render method, including registering the events with Page.GetPostBackEventReference(...). I suspect that I'm doing some unnecessary or difficult work here, but this is a new step to me. Alvaro Mendez wrote: Use Request["nameOfHiddenInputField"] to get its data. Thanks for that - this will be the first thing I try - it works will with what I've already got. Alvaro Mendez wrote: If you go this route, remember to override OnInit and call EnsureChildControls() in there. If either of the first two responses work, I hope I don't have to go here. :)
-
Thanks for the quick response! Alvaro Mendez wrote: You would do it the same way it's done inside the InitializeComponent method. Not sure what you mean here. All of my control output is taking place in the Render method, including registering the events with Page.GetPostBackEventReference(...). I suspect that I'm doing some unnecessary or difficult work here, but this is a new step to me. Alvaro Mendez wrote: Use Request["nameOfHiddenInputField"] to get its data. Thanks for that - this will be the first thing I try - it works will with what I've already got. Alvaro Mendez wrote: If you go this route, remember to override OnInit and call EnsureChildControls() in there. If either of the first two responses work, I hope I don't have to go here. :)
Kerry MacLean wrote: Thanks for the quick response! You did say it was urgent. :-) Kerry MacLean wrote: Not sure what you mean here. All of my control output is taking place in the Render method, including registering the events with Page.GetPostBackEventReference(...). I suspect that I'm doing some unnecessary or difficult work here, but this is a new step to me. I meant that the code for registering events would be identical to the one found normally in the
InitializeComponent
method populated by the designer. Based on what you're trying to accomplish though, that probably won't work. If you haven't already, take a look at this link[^] which may help you straighten things out. Regards, Alvaro
-
Kerry MacLean wrote: Thanks for the quick response! You did say it was urgent. :-) Kerry MacLean wrote: Not sure what you mean here. All of my control output is taking place in the Render method, including registering the events with Page.GetPostBackEventReference(...). I suspect that I'm doing some unnecessary or difficult work here, but this is a new step to me. I meant that the code for registering events would be identical to the one found normally in the
InitializeComponent
method populated by the designer. Based on what you're trying to accomplish though, that probably won't work. If you haven't already, take a look at this link[^] which may help you straighten things out. Regards, Alvaro