473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

A basic question

Hi,

Why do some always needed to be placed inside a <form runat=server> where as
few other dont require that?

How do I know if a given control (derived from System.Web.UI.Control or
System.Web.UI.WebControls) will work outside <form runat=server>

For ex, I can place <asp:Table ...> outside a <form runat=server> but not
<asp:DropDownlist>

Is it based on the fact if the given control can do a post back or not??

Thanks in advance..
Rajesh
Nov 19 '05 #1
6 1055
That is how html document object model is built.
Some html tags (text, textarea, select, checkbox, radio, button, submit),
must be placed inside a form tag.
Since web controls eventually are rendered to html elements,
they too have to follow these rules.
A table is not a form element, therefor it can be placed outside a form.
A DropDownlist is rendered to a select tag, which is a form element,
and must be placed inside a form.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
Hi,

Why do some always needed to be placed inside a <form runat=server> where as few other dont require that?

How do I know if a given control (derived from System.Web.UI.Control or
System.Web.UI.WebControls) will work outside <form runat=server>

For ex, I can place <asp:Table ...> outside a <form runat=server> but not
<asp:DropDownlist>

Is it based on the fact if the given control can do a post back or not??

Thanks in advance..
Rajesh

Nov 19 '05 #2
Hi Sharon,

Thanks for your reply.

In that case- I created a user control (derived from
System.Web.UI.UserControl) without any html tags like textarea, select etc.
It just contains a table with few images.

Why this usercontrol is forced to be placed inside a form tag? I agree that
potentially I can place html text box in the user control. But currently i
have none.

Any better ideas for this scenario?

Rajesh

"Sharon" <sh****@void.null> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
That is how html document object model is built.
Some html tags (text, textarea, select, checkbox, radio, button, submit),
must be placed inside a form tag.
Since web controls eventually are rendered to html elements,
they too have to follow these rules.
A table is not a form element, therefor it can be placed outside a form.
A DropDownlist is rendered to a select tag, which is a form element,
and must be placed inside a form.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
Hi,

Why do some always needed to be placed inside a <form runat=server> where
as
few other dont require that?

How do I know if a given control (derived from System.Web.UI.Control or
System.Web.UI.WebControls) will work outside <form runat=server>

For ex, I can place <asp:Table ...> outside a <form runat=server> but

not <asp:DropDownlist>

Is it based on the fact if the given control can do a post back or not??

Thanks in advance..
Rajesh


Nov 19 '05 #3
My guess is that UserControl must be placed inside a form,
to avoid potential form elements being placed out side a form.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:#h*************@TK2MSFTNGP12.phx.gbl...
Hi Sharon,

Thanks for your reply.

In that case- I created a user control (derived from
System.Web.UI.UserControl) without any html tags like textarea, select etc. It just contains a table with few images.

Why this usercontrol is forced to be placed inside a form tag? I agree that potentially I can place html text box in the user control. But currently i
have none.

Any better ideas for this scenario?

Rajesh

"Sharon" <sh****@void.null> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
That is how html document object model is built.
Some html tags (text, textarea, select, checkbox, radio, button, submit),
must be placed inside a form tag.
Since web controls eventually are rendered to html elements,
they too have to follow these rules.
A table is not a form element, therefor it can be placed outside a form.
A DropDownlist is rendered to a select tag, which is a form element,
and must be placed inside a form.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
Hi,

Why do some always needed to be placed inside a <form runat=server>

where
as
few other dont require that?

How do I know if a given control (derived from System.Web.UI.Control or System.Web.UI.WebControls) will work outside <form runat=server>

For ex, I can place <asp:Table ...> outside a <form runat=server> but

not <asp:DropDownlist>

Is it based on the fact if the given control can do a post back or not??
Thanks in advance..
Rajesh



Nov 19 '05 #4
Since the form tag can begin at the beginning of the body, and end at the
end of the body, I don't see why this should be an issue for you.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Sharon,

Thanks for your reply.

In that case- I created a user control (derived from
System.Web.UI.UserControl) without any html tags like textarea, select
etc.
It just contains a table with few images.

Why this usercontrol is forced to be placed inside a form tag? I agree
that
potentially I can place html text box in the user control. But currently i
have none.

Any better ideas for this scenario?

Rajesh

"Sharon" <sh****@void.null> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
That is how html document object model is built.
Some html tags (text, textarea, select, checkbox, radio, button, submit),
must be placed inside a form tag.
Since web controls eventually are rendered to html elements,
they too have to follow these rules.
A table is not a form element, therefor it can be placed outside a form.
A DropDownlist is rendered to a select tag, which is a form element,
and must be placed inside a form.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> Why do some always needed to be placed inside a <form runat=server> where
as
> few other dont require that?
>
> How do I know if a given control (derived from System.Web.UI.Control or
> System.Web.UI.WebControls) will work outside <form runat=server>
>
> For ex, I can place <asp:Table ...> outside a <form runat=server> but

not > <asp:DropDownlist>
>
> Is it based on the fact if the given control can do a post back or
> not??
>
> Thanks in advance..
>
>
> Rajesh
>
>



Nov 19 '05 #5
Yes your right on the money Kevin. You can only have 1 <form
runat="server"> anyways. So, this should not be an issue


"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Since the form tag can begin at the beginning of the body, and end at the
end of the body, I don't see why this should be an issue for you.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Sharon,

Thanks for your reply.

In that case- I created a user control (derived from
System.Web.UI.UserControl) without any html tags like textarea, select
etc.
It just contains a table with few images.

Why this usercontrol is forced to be placed inside a form tag? I agree
that
potentially I can place html text box in the user control. But currently
i
have none.

Any better ideas for this scenario?

Rajesh

"Sharon" <sh****@void.null> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
That is how html document object model is built.
Some html tags (text, textarea, select, checkbox, radio, button,
submit),
must be placed inside a form tag.
Since web controls eventually are rendered to html elements,
they too have to follow these rules.
A table is not a form element, therefor it can be placed outside a form.
A DropDownlist is rendered to a select tag, which is a form element,
and must be placed inside a form.

"Rajesh C K R" <__*****************@usa.net> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> Why do some always needed to be placed inside a <form runat=server>

where
as
> few other dont require that?
>
> How do I know if a given control (derived from System.Web.UI.Control
> or
> System.Web.UI.WebControls) will work outside <form runat=server>
>
> For ex, I can place <asp:Table ...> outside a <form runat=server> but

not
> <asp:DropDownlist>
>
> Is it based on the fact if the given control can do a post back or
> not??
>
> Thanks in advance..
>
>
> Rajesh
>
>



Nov 19 '05 #6
Only server side controls that you want/need to have their data posted back
to the server need to be put inside a <form runat=server>. I put server side
controls in the <head> tag all the time to specify <title> and <meta> directives,
but they don't accept user input and thus don't have anything to post back
to the server. Other controls such as Button, TextBox, DropDownList, etc
do need to go inside the <form runat=server>

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,

Why do some always needed to be placed inside a <form runat=server>
where as few other dont require that?

How do I know if a given control (derived from System.Web.UI.Control
or System.Web.UI.WebControls) will work outside <form runat=server>

For ex, I can place <asp:Table ...> outside a <form runat=server> but
not <asp:DropDownlist>

Is it based on the fact if the given control can do a post back or
not??

Thanks in advance..

Rajesh


Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: pauldepstein | last post by:
I am reading Grimshaw and Ortega's "C++ and Numerical Methods." They construct a vector class which contains the variable vec, a float* variable where the length of the array (number of...
6
by: DH | last post by:
I have a VERY basic question about figuring database size. I've inherited a database which is generally similar to this basic one: Item, Red, Blue, Green, Yellow (text), (int),(int),(int),(int)...
9
by: Malcolm | last post by:
After some days' hard work I am now the proud possessor of an ANSI C BASIC interpreter. The question is, how is it most useful? At the moment I have a function int basic(const char *script,...
4
by: Ramesh | last post by:
hi, Let me ask some basic questions. Can anybody explain me about the following questions: 1. When we have to create sn key? Whenever we compiled Component we have to create or it is a one time...
13
by: Pete | last post by:
I'm cross posting from mscom.webservices.general as I have received no answer there: There has been a number of recent posts requesting how to satisfactorily enable BASIC authorization at the...
5
by: Aussie Rules | last post by:
Hi, Having a mental block on this one. Have done it before but can't rack my brain on how... I have an object, with a bunch on property, and I add that object to a combo box. I want the...
4
by: MikeB | last post by:
I've been all over the net with this question, I hope I've finally found a group where I can ask about Visual Basic 2005. I'm at uni and we're working with Visual Basic 2005. I have some books, ...
1
by: frankhanretty | last post by:
Do I have to install Visual basic on the remote terminals as I did on the server? I have an visual basic 5 application running fine on my client's server and he is now networked. He wants to run the...
4
by: Chris Asaipillai | last post by:
Hi there My compay has a number of Visual Basic 6 applications which are front endeed onto either SQL Server or Microsoft Access databases. Now we are in process of planning to re-write these...
3
by: Scott Stark | last post by:
Hello, I'm trying to get a better handle on OOP programming principles in VB.NET. Forgive me if this question is sort of basic, but here's what I want to do. I have a collection of Employee...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.