Monday, March 26, 2012

working with code behind

hi...
when working with code behind:
i have a string i should print.
i can make a label control and in the code behind im printing:
label.text = "bla bla bla"
Also i noticed i can create public string variable:
public str as string = "bla bla"
and then in the aspx page i can print
<%=str%>
which way is better and the right to do,considering perfomence and maybe other issues?

10x> which way is better and the right to do,considering perfomence and maybe other issues?

if you can notice a performance difference, you're a better man than I.

though sometimes programming groups have a set of standards they should adhere to (and if you're in such a team you should follow the standards or talk to the boss-man), I think this is below trivial, really.
Hi,

Its always better you specify it in code behind (code separation). I am not sure of any performance advantages over classic asp kinda code.

HTH
Shamir

I doubt there would be any performance benefit either way. I think that it is very important for readability however, not to use any spagetti code (referring to<%...%>) if at all possible.

Another reason not to use spagetti code is that you should program within your page/control event handlers as much as possible, to take advantage of the object oriented development capabilities of ASP.Net.

Hi,

Maybe the 1st one.

The 2nd method like asp3.0 and I don't like it.
Forget about the classic ASP model...

do it the .NET way.....

don't use your server tags in your html anymore....

do it from your code behind.....

nothing to do with performance....but is member of a best practices list...

0 comments:

Post a Comment