contains an event. When the event is fired it creates an instance of a
server control that contains an event of its own. I would like to be
able to render the contents of the server control (HTML w/ event
JavaScript code) and store it for later use.
My problem lies when I call the MyControl.RenderControl method. It
returns valid HTML but does not contain the event code since the
control has not been added to any page object.
Here is what I have tried:
HtmlForm hForm = new System.Web.UI.HtmlControls.HtmlForm();
hForm.Attributes.Add("runat", "server");
hForm.Controls.Add(spWC);
Page p = new Page();
p.Controls.Add(hForm);
p.RenderControl(hWriter); // <-- error here stating that no Response
object available.
I do understand that I am getting a "Response not available" error
because there is no context associated with the newly created page
object. Any ideas as to how I can achieve the results I am looking
for?
-DavidOn Feb 21, 9:15 am, "Bob Jones" <goodold...@.gmail.comwrote:
Quote:
Originally Posted by
Hey everyone. I have another problem. I have an aspx web page that
contains an event. When the event is fired it creates an instance of a
server control that contains an event of its own. I would like to be
able to render the contents of the server control (HTML w/ event
JavaScript code) and store it for later use.
>
My problem lies when I call the MyControl.RenderControl method. It
returns valid HTML but does not contain the event code since the
control has not been added to any page object.
>
Here is what I have tried:
>
HtmlForm hForm = new System.Web.UI.HtmlControls.HtmlForm();
hForm.Attributes.Add("runat", "server");
hForm.Controls.Add(spWC);
>
Page p = new Page();
p.Controls.Add(hForm);
p.RenderControl(hWriter); // <-- error here stating that no Response
object available.
>
I do understand that I am getting a "Response not available" error
because there is no context associated with the newly created page
object. Any ideas as to how I can achieve the results I am looking
for?
>
-David
sp, nobody on here has any idea on how to get this working? Or if it's
even possible
0 comments:
Post a Comment