A small problem occurs when you use tabcontrol in Ajax toolkit.

Source: Internet
Author: User

When using tabcontrol in Ajax toolkit, we can easily implement winfromProgramThe Display Effect of the tab page in, such:

However, in tabpage, when a server control is generated, the control IDs are prefixed with the tabcontrol name on the HTML static page. For example, we add

Gridview<Asp: gridview id = "gvbooks" runat = "server"/>,The ID of gvbooks in the generated static page is changed to tabcontrol?tp=gvbooks,

If you want to operate gvbooks through JavaScript, you must note that the ID has changed when getting gvbooks! To use the ID in the generated static page,

For example:Document. getelementbyid ("Tabcontrolpolictp1_gvbooks"). Otherwise, a script error is always reported on the page.

 

This is just a strange problem I encountered in my testing project. I found it only after a long time of troubleshooting. Remember it. I hope it will be helpful to anyone who will encounter this problem in the future!

 

I found this happens when using this Ajax control in many places. Of course, it is rare to operate server controls through JS!

Related Article

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.