Multiple forms in a aspx page....

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, maybe someone can help me with what I am not seeing here. I already
know that I can have multible forms, but only one can have "runat=server".
This is how I am trying to render my other forms:

Dim form As HtmlForm = New HtmlForm
form.EnableViewState = False
form.Attributes.Add("Name", "test" & i)
form.Method = "post"
form.Attributes.Add("ID", "test" & i)
form.Attributes.Add("action", "cwebitems.aspx")
form.Attributes.Remove("runat")
form.Attributes.Add("runat", "client")
.....code that makes a table....
container.Controls.Add(form)

To me this code should add a form without the "runat=server" option on. If
that is correct, why do I get a "A page can have only one server-side Form
tag" error message? Am I doing this correctly?

Thanks,
Charles
 
Charles, creating a form via new HtmlForm automatically makes it a
server-side form (your creating in code on the server after all). Any
control that you dynamically create in ASP.Net will be server-side.

You'll need to check out something like
http://sourceforge.net/projects/wilsonwebform/ to get this working.

Karl
 
You're having server side code generate a form, so it generates a server
form that it can interact with.
You might have better luck concatenating a string together a little more
manually, such as:

Dim MyHTML as String = "<Form ID='test' Action='whatever.aspx'>"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top