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>
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>