[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

When is FORM tag needed in ASP.NET?

Posted on 2009-05-14
9
Medium Priority
?
414 Views
Last Modified: 2012-06-21
If you have a read only ASP.NET page, is the FORM tag needed?  Is it needed only for post backs?
0
Comment
Question by:brettr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24385749
if you have no application related to it... <codepage> statement at the very top... you don`t need a form tag... otherwise, you need it.
0
 
LVL 3

Assisted Solution

by:Viwind
Viwind earned 200 total points
ID: 24385770
form is only for a postback.
if the page is read only and has no dynamic content: no back-end code to refer to a control and update control's content, you can bypass form tag and just create a plain HTML in .aspx page.
0
 

Author Comment

by:brettr
ID: 24385781
ASP.NET controls still render.  You are saying if I want to use a datasource for those controls, I'll need the FORM tag?  Why is that?
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:brettr
ID: 24385805
>>form is only for a postback.<<

If I have a read only back with a few controls and two of them get their data source from the code behind page, that isn't a postback.  But they will still need the FORM runat=server right?
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24385886
form is for anything related to the application... read my post... controls, drop-downs, datasources, anything APPLICATION related, you need a form tag.
0
 

Author Comment

by:brettr
ID: 24385972
@MaxOvrdrv2

Uh...I'm going to go ahead and so no.  Drag a label onto a form.  Remove the form tags.  Run app.  Notice label (ie, control) still works fine.
0
 
LVL 10

Accepted Solution

by:
MaxOvrdrv2 earned 1800 total points
ID: 24386004
yeah, but try and create that same label in the code-behind and add it dnamically, and see it that works... anything application related = back-end code.
0
 
LVL 3

Expert Comment

by:Viwind
ID: 24386257
brettr,

why do you want to avoid Form tag?
asp.net pages will easily break with form tags when backend is used and it'll be inconsistent: as some pages have form and some pages don't have form.  It'll be difficult to maintain.

is there a specific requirements on your side to exclude form whenever possible or is it just a learning asp.net process whether to include form or not.


0
 

Author Comment

by:brettr
ID: 24387827
@MaxOvrdrv2
Thanks.  Last comment to the point.

>>or is it just a learning asp.net process whether to include form or not.<<
Yes - I'll try to state as much next time.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question