Remember the question about Ajax Control Toolkit animation, that is, because moving and other animation effects do not support dynamic parameters or methods, which makes us very passive;
The problem lies in "Hard coding". How can this problem be solved? We use the following scenario to describe: Put a checkbox in the repeater content template and bind the data source. Our goal is
After the user selects a checkbox, a product image is sent to the shopping cart on the record.
If we can use the <move horizontal = "geth ()" vertical = "getv ()"/> method, the problem does not exist, now we can only <move horizontal = "150" vertical = "-50"/>! What should I do? Our key issue is to determine which checkbox is clicked! Our solution is based on the following two facts:
1. Although we cannot use dynamic parameters, we can obtain the event source using this method:
<SCRIPT>
Function ()
{
Alert (event. srcelement. value );
Alert (event. srcelement. ID );
}
</SCRIPT>
<B> if this method works, we can solve the problem of animation effect </B> <br/>
</BR>
<Input id = myid type = button onclick = a (); value = test> </input>
2. Now we can get the ID of the event source. How can we determine which checkbox is used? Because after the data source is bound, many checkboxes are generated on the page!
We seem to have no way to go. when viewing the page source code, we found the "Savior". Please refer:
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl01_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl02_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl03_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl04_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl05_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl06_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl07_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl08_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl09_ctl00_dataitemcheckbox"
Id = "ctl00_maincontentplaceholder_resourcedatalist1_dynamicrepeater1_ctl10_ctl00_dataitemcheckbox"
This is the content displayed after repeater is parsed. Each checkbox has an ID. We also found a ct100 ct101 ct102 ct103 ct110 rule,
By analyzing the checkbox ID, we can determine the number of checkboxes !!
After? The animation problem persists !!! No, it has been solved. Do you still remember the condition animation effect? We only need to set a Boolean array;
<Condition conditionscript = "flag [0]">
<Move horizontal = "150" vertical = "-50"/>
</Condition>
<Condition conditionscript = "flag [1]">
<Move horizontal = "160" vertical = "-60"/>
</Condition>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.