Why Soo Slow ?

J

Jay

ASP.NET 2.0.

One line of code (checkbox onclick) in a databound grid really slows down
the page load...

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkEmp" onClick=<%# "HighlightRow(this, """ +
Eval("empname") + """)"%> runat="server" autopostback="False"/>
</ItemTemplate>
</asp:TemplateColumn>

If I remove the """ + Eval("employee_name") + """ part from the line
everything works great. Any ideas? Even the HighlightRow javascript
function is simple...

<script language="javascript">
<!--
function HighlightRow(chkB, empname)
{
xState=chkB.checked;
if(xState)
{
chkB.parentElement.parentElement.style.backgroundColor='yellow';
}
else
{
chkB.parentElement.parentElement.style.backgroundColor='whitesmoke';
}
}
-->
</script>

You may notice that the empname var is not eve used (yet) in the javascript.

Anyways, why would this take soo long for the page to load with the onclick
in place?

Thanks.
 
C

Chris Crowe [MVP 1997 -> 2006]

Becuase each row of the grid the code is evaluated - this can be slow.

You may be better to use a different method.

Check with an ASP.NET newsgroup for ASP.NET Gurus

--

Cheers

Chris Crowe [IIS MVP 1997 -> 2006]
http://blog.crowe.co.nz
 
C

Chris Crowe [MVP 1997 -> 2006]

Sorry I thought I was in an IIS Newsgroup.

--

Cheers

Chris Crowe [IIS MVP 1997 -> 2006]
http://blog.crowe.co.nz
------------------------------------------------


Chris Crowe said:
Becuase each row of the grid the code is evaluated - this can be slow.

You may be better to use a different method.

Check with an ASP.NET newsgroup for ASP.NET Gurus

--

Cheers

Chris Crowe [IIS MVP 1997 -> 2006]
http://blog.crowe.co.nz
------------------------------------------------


Jay said:
ASP.NET 2.0.

One line of code (checkbox onclick) in a databound grid really slows down
the page load...

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkEmp" onClick=<%# "HighlightRow(this, """ +
Eval("empname") + """)"%> runat="server" autopostback="False"/>
</ItemTemplate>
</asp:TemplateColumn>

If I remove the """ + Eval("employee_name") + """ part from the line
everything works great. Any ideas? Even the HighlightRow javascript
function is simple...

<script language="javascript">
<!--
function HighlightRow(chkB, empname)
{
xState=chkB.checked;
if(xState)
{
chkB.parentElement.parentElement.style.backgroundColor='yellow';
}
else
{
chkB.parentElement.parentElement.style.backgroundColor='whitesmoke';
}
}
-->
</script>

You may notice that the empname var is not eve used (yet) in the
javascript.

Anyways, why would this take soo long for the page to load with the
onclick in place?

Thanks.
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top