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!