Web Forms :: Significance / Material Difference That <form Runat="server"> Would Make In Scenario?
Oct 5, 2010
I am a bit confused about the significance of the <form runat="server"> on a page, and its effect on Page and Control life cycles.
For long, I have eliminated any Postbacks or Viewstate from my web forms. I just use web forms to render (often very very complex) UI to the client (composed of server-side controls as well as ExtJs or jQuery widgets etc).
After the UI renders, all interaction with server is asynchronous through web-services or http handlers. So, lately I have started omitting the <form runat="server"> tage also from my web forms.
And to my surprise, the code has NOT broken. The life-cycle events are generated normally on all controls, they have access to normal ASP.NET processing pipeline, and they render perfect;y. As there are no Postbacks, I do not need ViewState or control events
like click etc.
So, can somebody tell me if there's any material difference that <form runat="server"> would make in my scenario, or to ASP.NET page/control life-cycle??
I have to add some ajax to a site, and i can see that in the master page they are using traditional tag <form id="form1" action="ExternalSite.com?a=b" name="test">and I get a tag incorrectly formed when I add a runat="server" within the form tag - but without it I can't have a valid scriptmanager?
I've got the ImageButton wrapped inside a form tag with runat="server" but STILL getting this error at runtime. The form tag is at the very beginning (before my table) and end tag is at the end (after the table).
Since upgrading to VS2010, I've been having issuse up on issues with my apps. Some are pure asp.net web sites, other are webpats that are eventually be converted to a Sharepoint web part.
In one of these webparts, I'm building a tab control on the fly. It fetches data from the table via bll/dal. On my dev box I build this in the code file of the default.aspx file and rendering it in a panel, except that it get the said error. I'm quite sure this is how I've done it in VS2008, so I don't know what is going on here - see my code below.
I have a user control that employs many other controls (GridView, Images, Ajax Tool kit extenders, etc.). When called the RenderControl() method there is the dreaded "<control> must be placed inside a form tag with runat=server". Seems many people have run into this and suggest overriding erifyRenderingInServerForm on the page the control sits in. I tried to do this, but ran into other issues (for example the ajax control tool kit calendar extender started to complain about the extender not being registered properly).
When a form with a run at server is added there will be two forms with runat server and another error occurs.The details of the error are as follows.Control 'ctl00_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Control 'ctl00_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server.
Source Error:An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: [HttpException (0x80004005): Control 'ctl00_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server.] System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +2052287
Version Information: Microsoft .NET Framework Version:2.0.50727.1873; ASP.NET Version:2.0.50727.1433
I'm trying to upload files to Amazon. In their simple example, it's an HTML page with a bunch of hidden fields that pass the data needed. The problem is when I create that form in ASP.NET, I, inevitably, end up with a few extra hidden fields i.e. __VIEWSTATE and __VIEWSTATEENCRYPTED at the very least -- and that after setting EnableViewState to false on the page. No matter what I do, these two hidden fields are there. I've read some articles that indicate that I have no way of removing them from the page unless I can remove the <form runat="server"> all together.
I can imagine what the answer will be but I have to ask: is there a way to remove the form tag from an aspx page?
I assume the answer will be "No". Then my follow up question is: how am I going to upload a file to Amazon S3 using an aspx page?
Now, some may suggest that I should use a simple HTML page. Then my issue would be this: there are a whole bunch of parameters I need to get by making an API call first -- they're the ones that end up in those hidden fields. How can I upload my files without losing this server side functionality that I need in order to make the API call?
Here's what that upload form looks like -- according to Amazon:
With jQuery, in (document).ready I assigned a click function to all buttons of my asp.net (aspx) page. When I click a button outside , the function works properly.
When clicking a button INSIDE the form, it doesn't work. Why?
Here my default.aspx page:
[code]....
I'm using Visual Studio 2010. I tried also with jQuery 1.4.2, same problem.
I want to track equipment between three types of allocations. A piece of equipment can be allocated to an employee, to a customer facility or to a warehouse.
I have an equipment table, employee table, a customer table and warehouse table. Warehouse is where equipment is temporarily held and shared between multiple employees, it is a holding area.
Obviously each equipment item can only be allocated to one employee, customer or warehouse.
My original thinking was to make a table for EquipmentAllocations where it linked the EquipmentID and the id of the employee, customer or warehouse (all guids).
Eventually I will need to query the equipment to see where it is located/allocated. I will also need to query the employees to check what equipment is allocated to them.
I am trying to figure out the best way to handle this and I am looking for some guidance. I am sure many of you have had situations similar to this that you could draw upon to offer up some advice.
I am working on Asp.net 2.0.I have 1 problem.In my design <table ><td> <tr> structure is present.<table><tr>< td id="PanJan""< d>< r>< able>runat="server" is not use in this. How to find td, tr , table id when runat server property is not used.
if screen reader fill any content wrong then how to give info (if javascript is disabled) to user to go that field any fill the correct value. with jvascript we can show javascript alert but if js is disabled then? I need solution for asp.net 20 and PHP both.
I am a Windows forms programmer and I am familiar with the VB and VBA programming. Thus, I would like to ask:
** Can I directly start ASP.net without any prior knowlege of the ASP ? ** What is the best material to get learning the ASP.net from introductory level to the advance level?
I want to know differences between ASP.Net WebControls and Html Controls (with runat="server" attribute).
I also want to know the possible scenarios where I have to (or want to) prefer Html Controls (with runat=server) in place of asp.net server controls?
In case of some good articles on web, do forward me. But dont forward me the links with differences between webcontrols and html controls, because my question intended for runat="server" attribute.
I am facing one asp.net server side issue using vb.net the problem is i declared one html input hidden field in my page, the name is hidden1. but when i going to call that name into server side code, that time i got the below error, <b>Name "Hidden1" is not declared</b> Code below:
//is there anything wrong with the preceding way? Why ever use LoadControl? Control myLC = LoadControl("myControl2.ascx"); //Why ever do it the LoadControl way? }
I have created a basic website using ASP.net VB in order to display a diary of various user inputs to a website, I have created a register page, home page and once the use logs in it will direct them to a user logged in page where the entire contents of the diary database table are displayed, however I want the option when the user logs in the user will be able to see the entries that they have been created or been added to
I have created the following code used to return the entries from the database, basically I am selecting (displaying) for project diary name, start date, the creator of the diary, the diary user from the diary table in the database that the username entry field in the home page is equal to the diary creator or diary user (from the database). I am not too sure how I can relate the usernText.Text in the home page to connect to this page user_logged_in_page.
Code:Code: ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [DiaryName], [StartDate], [DiaryCreator], [DiaryUser] FROM [Diary] WHERE '" & ~Home_Login/usernText.Text & = DiaryCreator or DiaryUser'"> PropertyName="usernText.Text" Type="String" />