dayrender 이벤트에서 컨트롤을 추가 한 후에 나중에 컨트롤을 찾을 수있는 방법이 있습니까? 나는 시도했다asp.net 달력 컨트롤 내에서 컨트롤을 찾는 방법
calendar.FindControl("lblSample")
그러나 성공하지 못했다. 여기
내 코드의 일부는 더 명확하게하는 것입니다 : 이벤트 및 페이지로드를 완전히 렌더링protected void calSample_DayRender(object sender, DayRenderEventArgs e)
{
Label lblSample = new Label();
lblSample.ID = "lblSample";
lblSample.Text = "Sample";
e.Cell.Controls.Add(lblSample);
}
일 후, 나는 시도하고 다시
을 제어 할 수있는 링크 버튼 이벤트를protected void lbtnSave_Click(object sender, EventArgs e)
{
//Not working
Label lblSample = calSample.FindControl(lblSample);
//Also can't get to work, this was using Ross' suggestion and the recursive find function he wrote about. I'm probably just not using it correctly.
Label lblSample = ControlFinder.FindControl<Label>(calSample, "lblSample");
}
'FindControl' 재귀 적으로 검색하지 않을, 그래서 당신은뿐만 아니라 현재 어린이를 검색하는 당신의 자신을 만들 필요 해요,하지만 내 모든 용기의 아이들. –
여러 레이어로 반복해야 할 수도 있습니다. 귀하의 양식에 귀하의 통제가있는 ASP : Panel이 있다면 Form => Panel => Control을 탐색해야합니다. – StuartLC
참조 http://stackoverflow.com/questions/2209854/find-all-child-controls-of-specific-type-using-enumerable-oftypet-or-linq – abatishchev