Web page size

M

marss

Hi all,
With the advent of Service Pack 1 for Visual Studio 2005 we at last get
a possibility
to convert our old ASP.Net 1.1 web application to ASP.Net 2.0. We
converted it. And we were unpleasantly impressed. There are many just
praises about reduced ViewState but what about another controls?

For example:

LinkButton that causes validation renders as hyperlink with the script
in href attribute.
ASP.Net 1.1 (117 b)
javascript:{if (typeof(Page_ClientValidate) != 'function' ||
Page_ClientValidate()) __doPostBack('LinkButton1','')}
ASP.Net 2.0 (156 b)
javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("LinkButton1", "", true,
"", "", false, true))

You may say, that difference in 39 bytes is not so much. But with a
little rewriting of the source file it would be looked like
javascript:WebForm_DoPostBackWithOptions('LinkButton1','',true,'','',false,true)
and difference become more essential. It's looks like nobody in VS2005
developer's team tries to optimize code.

I want to particularly point to validators:
ASP.Net 1.1 (241 b)
<span id="RequiredFieldValidator1" controltovalidate="TextBox1"
errormessage="Value required" display="Dynamic"
evaluationfunction="RequiredFieldValidatorEvaluateIsValid"
initialvalue="" style="color:Red;display:none;">Value required</span>
ASP.Net 2.0 (520 b)
<span id="RequiredFieldValidator1"
style="color:Red;display:none;">Value required</span>
+
script in the body of a page:
var RequiredFieldValidator1 = document.all ?
document.all["RequiredFieldValidator1"] :
document.getElementById("RequiredFieldValidator1");
RequiredFieldValidator1.controltovalidate = "TextBox1";
RequiredFieldValidator1.errormessage = "Value required";
RequiredFieldValidator1.display = "Dynamic";
RequiredFieldValidator1.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator1.initialvalue = "";

Four validators on a page - 1kB of the additional traffic. Pretty
good, isn't it?
Or I am wrong and in the most countries internet has already changed to
intranet and page size is unimportant?

Would like to hear expert's opinions.

Sorry for my English.

P.S. Source for all examples is empty page + 3 controls:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:LinkButton ID="LinkButton1"
runat="server">LinkButton</asp:LinkButton>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1"
Display="Dynamic" ErrorMessage="Value
required"></asp:RequiredFieldValidator>
 
M

marss

Thanks for anwser, Nate

I have nothing against cross-browswer compliant script, I do not
understand whether it is necessary put all code in the page body
instead of separate file.

As for custom validators: either it supports existing validation schema
(and has no any advantages) or implements its own (but it causes
rewriting all controls that use old schema: Button, LinkButton, etc).
 
B

bruce barker

ms decided xhtml conformance was desirable. this means no custom
attributes are allowed, so they had to be moved to javascript objects
and quotes must be quoted.


-- bruce (sqlwork.com)
Hi all,
With the advent of Service Pack 1 for Visual Studio 2005 we at last get
a possibility
to convert our old ASP.Net 1.1 web application to ASP.Net 2.0. We
converted it. And we were unpleasantly impressed. There are many just
praises about reduced ViewState but what about another controls?

For example:

LinkButton that causes validation renders as hyperlink with the script
in href attribute.
ASP.Net 1.1 (117 b)
javascript:{if (typeof(Page_ClientValidate) != 'function' ||
Page_ClientValidate()) __doPostBack('LinkButton1','')}
ASP.Net 2.0 (156 b)
javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions(&quot;LinkButton1&quot;, &quot;&quot;, true,
&quot;&quot;, &quot;&quot;, false, true))

You may say, that difference in 39 bytes is not so much. But with a
little rewriting of the source file it would be looked like
javascript:WebForm_DoPostBackWithOptions('LinkButton1','',true,'','',false,true)
and difference become more essential. It's looks like nobody in VS2005
developer's team tries to optimize code.

I want to particularly point to validators:
ASP.Net 1.1 (241 b)
<span id="RequiredFieldValidator1" controltovalidate="TextBox1"
errormessage="Value required" display="Dynamic"
evaluationfunction="RequiredFieldValidatorEvaluateIsValid"
initialvalue="" style="color:Red;display:none;">Value required</span>
ASP.Net 2.0 (520 b)
<span id="RequiredFieldValidator1"
style="color:Red;display:none;">Value required</span>
+
script in the body of a page:
var RequiredFieldValidator1 = document.all ?
document.all["RequiredFieldValidator1"] :
document.getElementById("RequiredFieldValidator1");
RequiredFieldValidator1.controltovalidate = "TextBox1";
RequiredFieldValidator1.errormessage = "Value required";
RequiredFieldValidator1.display = "Dynamic";
RequiredFieldValidator1.evaluationfunction =
"RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator1.initialvalue = "";

Four validators on a page - 1kB of the additional traffic. Pretty
good, isn't it?
Or I am wrong and in the most countries internet has already changed to
intranet and page size is unimportant?

Would like to hear expert's opinions.

Sorry for my English.

P.S. Source for all examples is empty page + 3 controls:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:LinkButton ID="LinkButton1"
runat="server">LinkButton</asp:LinkButton>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1"
Display="Dynamic" ErrorMessage="Value
required"></asp:RequiredFieldValidator>
 
M

marss

bruce said:
ms decided xhtml conformance was desirable. this means no custom
attributes are allowed, so they had to be moved to javascript objects
and quotes must be quoted.


-- bruce (sqlwork.com)

Hello, Bruce,
I completely disagree with you about impossibility of custom attributes
use in xhtml compliant pages, but anyway, thanks for your opinion.
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top