Why do we like ASP.net again?

T

tatemononai

Not to rant, but just in general, ASP.Net seems to be a lot more hassle
than traditional ASP. I enjoyed lots of dynamic GUI work with
traditional ASP. And I'm a desktop developer by trade, so I love OOP
and thought ASP.Net was going to be a web-based version of MFC or even
Visual Basic, but it's not. Making changes to the GUI is like pulling
teeth. I have almost NO control over the HTML code. Building a
skinned interface was incredibly painful, but I managed to get it
working finally.

And now I can't get a simple table to be visible or invisible. I can,
but then my button events won't fire, which makes the whole page
worthless. If you don't know what I'm talking about here, try taking
an <asp:button> and putting it inside a <asp:table>. The button events
stop working.

How about response.write? What is the point of response.write on an
ASP.net page? All it does it write to the beginning of the HTML
stream. It blows away your entire interface. If response.write could
be pointed to a specific spot in the stream, like after you've dumped
your header code out, then it would actually be useful. In traditional
ASP I can control where response.write writes to.

I'm trying to build a very simple page right now. It's a simple signup
form that creates a userid/password entry in a database, sends a
confirmation email that the user has to reply to, and then activates
the account. I want all of this to work from ONE aspx file. So I need
the content of the page to be dynamic and change depending on the stage
of the signup. Kind of like turning a page. The text and input field
are different from one page to another. In traditional ASP I could
easily have a simple switch/select statement that pukes out the right
block of HTML code for the stage of operation. But with ASP.Net, no
no, it's not quite so easy. I have to manually hide and show each and
every single freaking edit field and label on the whole page. But
guess what folks, I CAN'T hide the tables that are on the page because
they are in HTML. So when I hide my fields and text labels and show
others, the layout of the page is all screwed up. And, yes, I know
about server-side tables with <asp:table>. But, like I said, that will
disrupt the operation of the page by killing all the events that fire.
And it also makes editing the table a REAL BIG HASSLE.

Can someone please explain to me how ASP.Net is better, and why I
should keep using it instead of dumping it now and going back to
traditional ASP? I'm honestly a split hair away from giving this
steaming pile of crap the boot. It may be good for newbies who don't
understand the communication that takes place between the client and
server. Guys who just want to slap up a simple data entry form, but it
sucks for people who actually want to generate dynamic content. Sure,
it makes some things easier. And it does this by taking all the
control away. Getting that control back is not fun.
 
L

Lau Lei Cheong

I think that what makes you painful is that, when you change from ASP to
ASP.NET, you replace all controls with <asp:WhateverControls>, and it's not
necessary.

All you have to do is to place runat="server" attribute to the HTML controls
like what you have to in ASP, then switch to design view and back, and look
at the codebehind, you'll see the IDE has created the necessary object
declarations for you.
And then you can call control_name.visible = false to make it invisible. But
considering making table invisible will make another button can't fire
event... have you checked all your tags are closed properly?

For Response.write(), you shouldn't call it that way. You should put
everything you want to place under Literal control instead (<asp:Literal>).
I believe the only purpose to call Response.write() in ASP.NET is the time
you wanted to output binary steams of another file type, let's say, JPEG
images.

Just remember, in ASP.NET you're manipulating controls, not the HTMLs. If
you ever want your code to change the behaviour of certain HTML controls,
give it an ID and mark it runat="server", then use your codebehind to access
it. This will serve in most cases.

You should also note that most ASP style calls are still functional in
ASP.NET environment, just with little syntax changes like you have to put ()
around parameters even if you're calling procedures, yet that doesn't take
too much time to learn.

ASP.NET is better in many ways. To speak about some, the most important
aspect IMHO is better exception handling. The error text are more clear and
the stack trace is more accurate than that of traditional ASP. And the
improved set of librarys allow many troublesome things like sending emails
much easier. And I do enjoy clear defination of different events. :D There's
yet many areas to explore with... spend some time to take a closer look at
it.

Regards,
Lau Lei Cheong
 
L

Lau Lei Cheong

I don't think it's worthwhile to buy the book for someone already have
strong ASP background, the book is simply too basic.

Perheps it's good to take a look on this site, he doesn't have to pay
anything for it anyway even it doesn't help. And I think the technical level
is just enough for someone moving from ASP to ASP.NET.
http://www.w3schools.com/aspnet/aspnet_intro.asp
 
G

Guest

just a note:

when you mention that you have to hide the controls on the page its
definitly not the best way to approach this.
In .aspx you can easy create one page that does several things, and can be
sued with your signup form. Try to putting <asp:panel>'s instead of hiding
every piece of html that you got, something like this:

<script language="c#" runat="server">
void Page_Load() {

// some code to check what step we are on
// then just load the appropriate panel
Load_Panel(step);
}

void Load_Panel(int panel) {
// set all panels to visible = hidden
startsignup.visible = false;
complete.visible = false;
verifywithemailactivationcode.visible = false;
verifycompleteactivateaccount.visible = false;

if (panel == 0)
startsignup.visible = true;

if (panel == 1)
complete.visible = true;

if (panel == 2)
verifywithemailactivationcode.visible = true;

if (panel == 3)
verifycompleteactivateaccount.visible = true;
}
</script>
<html>
<head>
<title>Signup</title>
</head>
<body>
<form runat="server">

<asp:panel id="startsignup" runat="server" visible="false">
<!-- Code here to display your html fields (input boxes) -->
</asp:panel>

<asp:panel id="complete" runat="server" visible="false">
<!-- tell the suer that an email has been sent out to his email -->
</asp:panel>

<asp:panel id="verifywithemailactivationcode" runat="server" visible="false">
<!-- input box for the email verification -->
</asp:panel>

<asp:panel id="verifycompleteactivateaccount" runat="server" visible="false">
<!-- let the user know that its complete -->
</asp:panel>

</form>
</body>
 
K

Kevin Spencer

Okay, you've been using ASP for years now. You're like a single-engine
pilot, used to flying by the seat of your pants, and you know how everything
works. Now you're introduced to a Boeing 747. You say to yourself, "it's a
plane. It has a rudder. It has wings. How much more difficult can it be to
fly? So, you read a couple of articles about 747s and get in one. Lo and
behold, you can't even get it off the ground. Why? Is it because there's
something wrong with a 747? No, i'ts just a lot more powerful, and a lot
more complicated. But will a Cessna land itself if it has to?

Sure, it's hard to learn. But you have 2 choices, and only 2:

1. Take the time to really learn it.
2. Fly Cessnas instead

--
HTH,

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

Guest

Ha ha Kevin. I like your style.
Just a note though the second more powerful engines of a 747 only takes you
faster to where your going to crash :p
 
K

Kevin Spencer

Ha ha Kevin. I like your style.
Just a note though the second more powerful engines of a 747 only takes
you
faster to where your going to crash :p

No doubt, I am Sam. That's why it takes so much longer to learn to fly one
properly! Power = Responsibility = DANGER WILL ROBINSON!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top