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

  • Home
  • SEARCH
  • 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 8580041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:44:31+00:00 2026-06-11T20:44:31+00:00

I noticed a weird problem in C# and it’s been bothering my head for

  • 0

I noticed a weird problem in C# and it’s been bothering my head for weeks, so I thought I just put this question out there. So my question is basically how does C# handle multiple client <form>‘s inside the server form <form runat="server">? I’ve been writing a web site and I’ve encountered a very strange problem.

So here’s the essential breakdown to recreate this problem.

1) Have a simple javascript method with an alert inside that fires if it is called.

 eg:   function tester() {
         alert("adf");
       }

2) Open a brand new Web Forms project in Visual Studios 2010. (It should have a <form runat="server"> already created inside for you.)

  eg: <form runat="server"> <form/>
     You can only have one of these.

3) Now inside this form tag, write an empty form tag that should theoretically do nothing:

  eg: <form action=""><form/>

4) Now Create another form right after this form that calls the javascript method.

  eg: <form action="javascript:tester()" >
       <button type="submit" >Search</button>
        </form>

5) Run this code now, and you should see the alert pop up after you press the button.

6) Now take out the empty form tags:
Delete: <form action=""><form/>

7) Run code again, and now you should find that your javascript call is not firing anymore, and it would rather be refreshing the page every time you press the button.

So this is my problem that has been bothering me, and I hope some guru may have an answer for me soon, for this has been bothering my head for a long time. I have no idea why it works with two forms, and why it doesn’t with just one form. Hope someone can answer this soon. Thanks so much in advance!!!

Some Helpful Information:

According to this page, I can have multiple “client” based form tags and that shouldn’t be a problem…

Why you can't have a page with multiple server-side Form tags?

…however… the problem somehow still manifests itself.

  • 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-06-11T20:44:32+00:00Added an answer on June 11, 2026 at 8:44 pm

    Having a form tag within a form tag is against the html specifications, and thus any result would be undefined behavior.

    For your particular problem, can you not do this?

    <button onclick="tester();">Search</button>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Weird problem this, I'm using a CSS3 gradient to create a faded out overlay
I'm not quite sure I understand what Html.RenderAction() does. I've just noticed one weird
I just noticed something weird, when creating a menu for a website. Take a
Ok just noticed some weird behavior in my code and just trying to get
I've been getting weird results and I finally noticed that my habit of putting
I've been working for a while on image processing and I've noticed weird things.
We've recently moved servers and have been noticing some weird problems. The main problem
So I've noticed some very weird behaviour from my program. Here's a simplified code
Noticed this today when a patch was submitted with the following line: lblCompletionTime.Text =
I noticed that there are two sets of Hadoop configuration parameters: one with mapred.*

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.