2013-12-08 1 views
1

dropdownlist의 값을 변경할 때. selectedIndexchangePageLoad 이벤트 전에 호출해야합니다.PageLoad 이벤트 전에 dropInlist selectedIndexchanged를 호출 할 수 있습니까?

dropdownlistselectedIndexchanged으로 전화하려면 어떻게해야합니까? PageLoad 이벤트 전에?

+1

IHMO, 우선 다음 질문을 발사 당신이 어딘가에 얻을 것이다 의심에 대한 자세한 내용을 검색 할 수 있습니다. http://stackoverflow.com/questions/373885/handle-event-before-page-load 이제 asp로 들어가기 전에 ASP.NET 페이지 수명주기를 이해하면 더 좋습니다. –

답변

0

(단위 : ASP.NET) Life cyclePage_Load 이벤트가 먼저 발생한 다음 다른 control 이벤트가 발생합니다.

dropDownListSelectedIndexChanged 이벤트를 SelectedIndexChanged 이벤트를 수동으로 호출하여 Page_Load 이벤트 처리 코드를 첫 번째 단계로 실행하면됩니다.

이 시도 :

protected void Page_Load(object sender, EventArgs e) 
{ 
     //call the DropDownList1 selectedindexchanged event manually 
     dropDownList1_SelectedIndexChanged(sender, e); 

     //page load event handling code 

} 

protected void dropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
{ 
    //DropDownList1 SelectedIndexChanged event handling code. 
} 
관련 문제