Monday, July 19, 2010
must be placed inside a form tag with runat=server
5:16 PM |
Posted by
Sheen |
Edit Post
I got to explain the scenario I cameacross this issue, as this might vary for some other scenarios. I got this error when I try to override the PreRender event of the masterpage's
Content Holder (idea was to get the html of that area what evel loding in to that).
ContentPlaceHolder cph = (ContentPlaceHolder)Master.Controls[0].FindControl("master_content_holder");
var sb = new StringBuilder();
var sw = new StringWriter(sb);
var htmlTxtWr = new HtmlTextWriter(sw);
SmtpUtil smtpUtil = new SmtpUtil();
cph.RenderControl(htmlTxtWr);
I got this error exactly on the last line of code. As error message states our all controlls must be inside a form tag with runat = server (note you can't have form tags on child pages, do not try it, it won't work). I did a small dirty work as to fix this issue.
I just overrided the VerifyRenderingInServerForm mehtod on child page. For me it worked properly, as i didn't have any verification to be done on my page. Be carefull before use.
Content Holder (idea was to get the html of that area what evel loding in to that).
ContentPlaceHolder cph = (ContentPlaceHolder)Master.Controls[0].FindControl("master_content_holder");
var sb = new StringBuilder();
var sw = new StringWriter(sb);
var htmlTxtWr = new HtmlTextWriter(sw);
SmtpUtil smtpUtil = new SmtpUtil();
cph.RenderControl(htmlTxtWr);
I got this error exactly on the last line of code. As error message states our all controlls must be inside a form tag with runat = server (note you can't have form tags on child pages, do not try it, it won't work). I did a small dirty work as to fix this issue.
I just overrided the VerifyRenderingInServerForm mehtod on child page. For me it worked properly, as i didn't have any verification to be done on my page. Be carefull before use.
Subscribe to:
Post Comments (Atom)
Blog Archive
Important Blogs
-
-
Git Workflow For Enterprise development6 years ago
-
-
Watch Live Cricket Online Free14 years ago
-
-
-
0 comments:
Post a Comment