ASP. NET get control in different frame

Source: Internet
Author: User

recently in the Web site encountered a problem, need to get a different frame control, ask some colleagues, they say it is not available ,

Find a lot of information on the Internet, found a solution, now tidy up the original solution:

1. I need to control the display of a div control in the Leftframe in mainframe, as shown in:

2, directly in the mainframe through the document.getElementById (' Div1 ') to obtain, the results cannot be obtained;

3, since directly can not get, that I could first get all the controls in the Leftframe, try a bit, it is possible;

1 var iobj=parent.document.getelementbyid ('leftframe'). Contentwindow;

4, have already taken all the controls, then I take a div, is not very good to take, as follows;

1 iObj.document.getElementById ('divtiernotes'). style.display= ' None ';

5, so the problem is solved.

Full code:

1 js file:2 function Chktiernotedis (Strdis)3 {4     //compatible with all browsers5     varIobj=parent.document.getelementbyid ('Leftframe'). Contentwindow; 6IObj.document.getElementById ('Div1'). style.display=Strdis;7 }8 9 Backstage:Ten stringStrdis ="None"; OneClientscript.registerstartupscript ( This. GetType (),"Key","<script>chktiernotedis ('"+ Strdis +"');</script>");

ASP. NET get control in different frame

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.