extremely slow when adding onclick event inside Repeater

F

felixch

Hi all,

I tried to add an OnClick event to a LinkButton by using
Attribute.sAdd, which resides in a Repeater and the Repeater is bind
with a DataTable with around 2000 records. If I try to run the page in
debug mode it takes more than 1 mins to load and consumes alot of
memory. If I remove the line: h.Attributes.Add("OnClick",test()), it
only takes a few seconds to load. Furthurmore, If I run the page
without debug mode, it also takes a few seconds to load. Can anyone
explain to me why? And how can I get the page to run faster in debug
mode?

Here is the code snippet:

protected void Repeater1_ItemCreated(object sender,
RepeaterItemEventArgs e)
{
LinkButton h = (LinkButton)((RepeaterItem)e.Item).Controls[1];
h.Attributes.Add("OnClick", "test1()");
}

Thanks,
Felix
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top