내가 마스터 페이지에 스크립트 관리자가 있습니다비동기 포스트 백 후 사용자 컨트롤을 렌더링에 대한 문제를 갖는
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptLocalization ="true" EnableScriptGlobalization ="true" EnablePartialRendering="true" >
</asp:ScriptManager>
MyPage.aspx을 (마스터 페이지의 ContentPlaceHolder에 배치)
<asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional" EnableViewState="true">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRefresh" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:PlaceHolder ID="placeHolder1" runat="server" EnableViewState="true"></asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
MyPage.aspx 스크립트 :
$(document).ready(function() {
setInterval(myfun, 20000);
});
function myfun() {
var btn = document.getElementById('<%=btnRefresh.ClientID%>');
btn.click();
}
자리 표시 자에 사용자 컨트롤이 포함 된 동적으로 생성 된 테이블을 배치하고 있습니다. 페이지로드시 페이지의 사용자 컨트롤을 볼 수 있습니다. 하지만 비동기 포스트 백이 20 초 후에 호출되면 사용자 컨트롤이 표시되지 않습니다. 방화 광구가 있으면 사용자 컨트롤이 있음을 알 수 있습니다. 그러나 그들은 렌더링되지 않습니다. 비동기 포스트 백에서 다시 만들지 만. 그들은 비어있는 것처럼 보입니다. 도움.
page_load 이벤트 코드를 표시 할 수 있습니까? – jams
protected void Page_Load (개체 보낸 사람, EventArgs 전자) { \t if (! Page.IsPostBack) { \t GetData(); // 데이터베이스에서 데이터 가져 오기 \t LoadUserControls(); // 사용자 정의 컨트롤을 포함하는 동적 테이블을 생성하십시오 } } – mike44