Obtain the client Control ID

Source: Internet
Author: User

I believe many of my friends have encountered some problems! This once made me depressed for a while, that is to say, if a user control is used in another place, you must view the source file and find the ID of the space on the client.

One method I wrote is:
Function selectproduct (PARAM)
{
Ctl00_m_g_6e621127_5514_4beb_805a_cd87e5949b43_ctl00_callback1.callback (PARAM );
}
// Ctl00_m_g_6e621127_5514_4beb_805a_cd87e5949b43_ctl00_callback1 is the ID displayed by a client named callback1. different clients will display different IDs;

Later, I accidentally met a built-in property. clientid:
So it should be in the following form.
<SCRIPT type = "text/JavaScript">
// Image preloading
VaR img1 = new image ();
Img1.src = '../wpresources/sitemap/spinner.gif ';
Function selectproduct (PARAM)
{
<% = Callback1.clientid + ". Callback (PARAM)" %>;
}
</SCRIPT>
// Callback1.clientid is used to obtain the ID of callback1 displayed on the client. This increases the flexibility.

Reference Method:
<SCRIPT type = "text/JavaScript">
Function panelclick (sender, e ){
VaR messages = $ get ('<% = messages. clientid %> ');
Highlight (messages );
}

Function activetabchanged (sender, e ){
VaR currenttab = $ get ('<% = currenttab. clientid %> ');
Currenttab. innerhtml = sender. get_activetab (). get_headertext ();
Highlight (currenttab );
}

VaR highlightanimations = {};
Function highlight (EL ){
If (highlightanimations [El. uniqueid] = NULL ){
Highlightanimations [El. uniqueid] = ajaxcontroltoolkit. animation. createanimation ({
Animationname: "color ",
Duration: 0.5,
Property: "style ",
Propertykey: "backgroundcolor ",
Startvalue: "# ffff90 ",
Endvalue: "# ffffff"
}, El );
}
Highlightanimations [El. uniqueid]. Stop ();
Highlightanimations [El. uniqueid]. Play ();
}

Function togglehidden (value ){
$ Find ('<% = tabs. clientid %>'). get_tabs () [2]. set_enabled (value );
}
</SCRIPT>

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.