You can only have one form runat="server"
per page apparently.
My page has one form, where it loads in a list of names. This form allows you to add a new name to the list as well.
I've attatched an onclick evevent to each name in the listview, when you click on it I need it needs to load the data into the edit form (next to the add form) with Javascript, I can do this fine.
But how do I structure it on the page to have two forms?
An illustration:
<table>
<tr>
<td style="width:50%;" valign="top">
<form runat="server" action="productCats.aspx?action=new&mid=2">
<div class="subHead">Create New Category</div>
<table class="settingTable">
<tr>
<td colspan="2"><b>Category Name</b></td>
</tr>
<tr>
<td>
<asp:TextBox ID="catName" runat="server" CssClass="tbox widebox"></asp:TextBox>
<asp:RequiredFieldValidator runat="server"
id="ValidatorName"
ControlToValidate="catName"
ErrorMessage="You need to enter a category name"
display="Dynamic" />
</td>
</tr>
<tr>
<td>This is the name of your category.</td>
</tr>
<tr>
<td colspan="2"><b>Parent Category</b></td>
</tr>
<tr>
<td>
<asp:ListBox SelectionMode="Single" Rows="8" id="parent" runat="server" CssClass="tbox widebox">
<asp:ListItem Selected="True" Text="Top Level" Value="0"></asp:ListItem>
</asp:ListBox>
<asp:RequiredFieldValidator runat="server"
id="RequiredFieldValidator1"
ControlToValidate="parent"
ErrorMessage="You need to select a parent"
display="Dynamic" />
</td>
</tr>
<tr>
<td>Choose a parent this category belongs to.</td>
</tr>
</table>
<asp:Button id="id" text="Create" runat="server" />
</form>
</td>
<td style="width:4%;">
</td>
<td valign="top">
<div class="subHead">Modify Category</div>
<form id="Form1" action="productCats.aspx?action=update&mid=2">
<table class="settingTable">
<tr>
<td colspan="2"><b>Category Name</b></td>
</tr>
<tr>
<td>
<asp:TextBox ID="newCatName" runat="server" Enabled="false" CssClass="tbox widebox"></asp:TextBox>
<asp:RequiredFieldValidator runat="server"
id="RequiredFieldValidator2"
ControlToValidate="newCatName"
ErrorMessage="Enter a new category name"
display="Dynamic" />
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>