Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1010671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:07:11+00:00 2026-05-16T09:07:11+00:00

You can only have one form runat=server per page apparently. My page has one

  • 0

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 event to each name in the listview. When you click on it, I need it to load the data into the edit form (next to the add form) with JavaScript code; 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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:07:11+00:00Added an answer on May 16, 2026 at 9:07 am

    ASP.NET Web Forms works by having just one <form> element on a page, and getting this posted back to the same page every time something changes (postbacks). Trying to use multiple forms, and specifying custom action attributes on the form element is going against what the framework is designed to work with, and that’s never really a good idea.

    I would just try to get rid of the second <form> element, and remove the action attribute from the first <form>. Also, ASP.NET will be much happier if everything is inside the form, i.e. your <table> tags at the top of the page.

    I’m not sure what your page is doing, but if you’ve got a TextBox and you’re using the contents of this to add items to a ListBox, a more Web Forms-like approach would be to use some control to do a postback when the TextBox has been filled in, and then re-bind the ListBox to some kind of data source. Maybe use an UpdatePanel if you want an Ajax postback.

    If you’re more comfortable with JavaScript and query string parameters, maybe ASP.NET MVC would be a better fit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It looks like you can only have one lifecycle policy per plugin type in
In my application I am getting this error: You can only have one <head
I can't figure out why I'm getting this error. I only have one class
This works when I have only one state code as a parameter. How can
Using web forms I know that you can only have one ASP.NET form on
I just learned (the hard way) that Java Component s can only have one
I have two tables, users and hra. A user can only have one record
I know that ScrollView can have only one Child but in my case I
In UML sequence diagram a method can have only one return line (at least
I have the following HTML that can appear but only one at a time:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.