-1

I'm writing the below code to get the html of a div element:

var sb = new StringBuilder();
MyDiv.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
string s = sb.ToString();
Session["RecoveryItems"] = s;

But it throws the error:

Textbox controls must be inside a form tag.

I'm using master page with form tag and inside the aspx page i have a user control which contains the div. The div is populated with server code. with table, label control and textbox. I tried adding form tag inside the user control before the div

1 Answer 1

0

The div element must be inside the form control. Create the div server control in the aspx page and give it an id="someid" and runat="server" attribute and then try adding the textbox to that Div server control

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.