Is it possible to strictly use this type of programming for web forms ?

  • Thread starter Thread starter Tony Girgenti
  • Start date Start date
T

Tony Girgenti

Hello.

When i develop a web form program using VS.NET 2003(VB), ASP.NET 1.1, i can
put a statement like this in my VB code-behind source file:

Me.btnGetArchivedTrips.Attributes.Add("onMouseOver", "alert('mouse over')")

When i do a search on the internet or wherever for ASP.NET client-side
javascript examples, 99% of the time, i get examples in javascript that are
coded in the HTML file for the web form.

Is it possible to do all of the things that can be done(or even most things)
in ASP.NET on a web form, using the above type of statements in the VB
code-behind file ? In other words, to not have to go into the HTML file to
do "javascript"(or whatever name you use for it).

Along with that, is there a name for that type of programming ?

I hope i explained that correctly.

Any help would be gratefully appreciated.

Thanks,
Tony
 
Tony said:
Hello.

When i develop a web form program using VS.NET 2003(VB), ASP.NET 1.1, i can
put a statement like this in my VB code-behind source file:

Me.btnGetArchivedTrips.Attributes.Add("onMouseOver", "alert('mouse over')")

When i do a search on the internet or wherever for ASP.NET client-side
javascript examples, 99% of the time, i get examples in javascript that are
coded in the HTML file for the web form.

Is it possible to do all of the things that can be done(or even most things)
in ASP.NET on a web form, using the above type of statements in the VB
code-behind file ? In other words, to not have to go into the HTML file to
do "javascript"(or whatever name you use for it).

Yes, it's possible, but it's also a waste of execution time. Also, every
element that you want to add attributes to has to be turned into a
server object.

You really should learn a bit about the page markup, and the html code
that is produced. It's very good for getting a grasp on what's really
going on. Myself, I hardly ever use the design mode, I only edit the
page markup.
Along with that, is there a name for that type of programming ?

Inefficient. ;)
 
Hello Goran.

You sound pretty adamant about avoiding that type of programming. I'm not
sure i understand yet, why it is so inefficient, but from what i am reading,
i think you are right. I should try to learn the html side of it.

I can't believe you totally work on the html side.

Thanks,
Tony
 
Hi Tony,

The problem with code-behind files is that they contain server-side coding
only. If you want to implement an event in a code-behind file, this means
that every execution of such an event needs a round-trip to the server, which
makes your web application very slow. So it is much more efficient to let
mouse events be handled at the client.

I hope this clarifies things a little for you.

Greetings, Vera
 
Back
Top