반응형
먼저 그림 설명
위의 화면은 중첩 마스터 페이지중에 서브 마스터 페이지의 컨트롤 들이다
위 화면은 Default페이지의 구현 화면
전체 소스
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { (FindControlRecursive(this.Master.Master, "Button1") as Button).Text = "great"; } public static Control FindControlRecursive(Control Root, string Id) { if (Root.ID == Id) return Root; foreach (Control Ctl in Root.Controls) { Control FoundCtl = FindControlRecursive(Ctl, Id); if (FoundCtl != null) return FoundCtl; } return null; } }
기존에 쓰던 방식~!
아래는 내가 삽질로 알아낸 기존의 방식이였다 ㅎㅎ ㅡ.ㅡ;;
ex)
((Label)Master.Master.FindControl("ContentPlaceHolder1"). FindControl("JoinInfo1").FindControl("Label1")).Font.Bold = true;
'.NET > ASP.NET' 카테고리의 다른 글
브라우저에서 콜백을 지원하는지 여부를 확인 (0) | 2009.11.18 |
---|---|
ClientScriptManager 클래스 클라이언트 콜백 구현 예제(C#) (0) | 2009.11.18 |
ASP.NET Page Life Cycle (0) | 2009.10.28 |
[asp.net] 코드 비하인드에서 동적으로 CSS 바꾸기 / System.Web.UI.AttributeCollection (0) | 2009.09.30 |
방법: 컴퓨터에서 사용 가능한 ASP.NET 성능 카운터 보기 (0) | 2009.07.22 |
[그림으로 보는 asp.net] 롤(Role Provider) 설정과 구현의 예 (2) | 2009.07.08 |
[그림으로 보는 asp.net] 컨텐츠 페이지에서 마스터 페이지 엑세스하기 (1) | 2009.07.01 |
[그림으로 보는 asp.net] 맴버쉽프로바이더(MembershipProvider) 구현 (0) | 2009.06.30 |