ASP.NET control closing tags

Just a general curiousity.  Can anyone explain the point behind the closing tags in ASP.NET development?  It just seems kind of verbose when you can use the text property to show any text that needs to be displayed?  Always wondered about this one.
stretch73Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David RobitailleAnalyst ProgrammerCommented:
That whole closing tag thing is all about being XHTML/XML "compilant"
I usually use this syntax when i dont have anything to put between the tags and i always use the text property.
<asp:textbox ID="textbox1" runat="server" test="text"/>
I use a closing tag only what is necessary, like when i do a dropdownlist with fixed items.
0
stretch73Author Commented:
I write my stuff the same way, but whenever I download demo code it seems like it's always written with the closing tag.  I figured there was some practical reason that I just hadn't heard of but I've never seen it addressed before.
0
David RobitailleAnalyst ProgrammerCommented:
well, i made a quick search because it was botherring myself for a wile too. i dident find anything
Maybe if you format a label like this the text proprety is not cached in the viewstate?
<asp:Label ID="Label1" runat="server" >label</asp:Label>
But, it may just be it`s just laziness from the demo`s author. Visual web developer format controls that way whenever you drag one in the page. They may have think it s easier to remove the closing tag that add it...
 
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

jmoreno8238Commented:
Remember that ASP tags are just like HTML tags whats the point of doing a <br></br> if you can do a <br />.
It's just how the standard is.

You can have a
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
And a
<asp:TextBox ID="TextBox1" runat="server" />

It's just how the standard works. and there's no sense in altering this since asp tags just get preprocessed server side and afterwards translated into html tags anyway.
0
David RobitailleAnalyst ProgrammerCommented:
i think stretch73 was mor wondering about the
<asp:Label ID="Label1" runat="server" >label</asp:Label>
VS
<asp:Label ID="Label1" runat="server" text="label" />
but i agree, it<s just how the standard work...
0
stretch73Author Commented:
I was just wondering because back in the classic ASP days, I was taught to use as few opening and closing <% tags as possible because it basically meant another round trip to the server.  Seems to me that a closed tag like <asp:label text='label' runat='server' />  makes more sense.  It couldn't make that much difference or I'm sure they'd specify which was better.  Thanks for the input.
0
David RobitailleAnalyst ProgrammerCommented:
I confirm you that it dont make much difference. it just make code easier to read
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.