All Web controls must be placed within a <form runat="server"> tag to function properly.
-
Hi I am confused regarding the statement All Web controls must be placed within a
tag to function properly. I have added the following to a webform in the code behind I have the following Literal1.Text = "Hello World"; I do not have the web contorl within tag so how come it works. I have also found that I can place other web controls on a web page and not have them between a tag and they work fine. I would appreciate it if some one can explain this to me Kind Regards
-
Hi I am confused regarding the statement All Web controls must be placed within a
tag to function properly. I have added the following to a webform in the code behind I have the following Literal1.Text = "Hello World"; I do not have the web contorl within tag so how come it works. I have also found that I can place other web controls on a web page and not have them between a tag and they work fine. I would appreciate it if some one can explain this to me Kind Regards
Hi, It also confused me initially. But what I found is that, only those web controls which needs a form tag to function are needed to be placed inside a form with Runat="server" attribute. I mean to say, when a form is submitted the value of the controls which will be posted back are of the above type. Thus textbox need to placed inside a form with runat="server" but for a label it is not mandatory. I hope this answers your question. Thanks,
Pradipta Basu
-
Hi I am confused regarding the statement All Web controls must be placed within a
tag to function properly. I have added the following to a webform in the code behind I have the following Literal1.Text = "Hello World"; I do not have the web contorl within tag so how come it works. I have also found that I can place other web controls on a web page and not have them between a tag and they work fine. I would appreciate it if some one can explain this to me Kind Regards
Only the controls that are rendered as form fields in the html code need to be inside the form to work. The reason they do is that when the form is posted, only the data from the fields that are within the form is included in the request.
--- single minded; short sighted; long gone;