2017-01-18 7 views
0

UpdatePanel에 Gridview가있는 코드를 사용합니다. Timer가 Gridview의 일부 내용을 확인하고 있습니다. 뒤에UpdatePanel의 오류 : 코드가 최적화되었거나 기본 프레임이 호출 스택 위에 있기 때문에 표현식을 평가할 수 없습니다.

<asp:TemplateField HeaderText="Zeichnung" ItemStyle-HorizontalAlign="Center"> 

코드 :

Response.ClearHeaders(); 
Response.ContentType = "application/pdf"; 
Response.Clear(); 
Response.AppendHeader("Content-Disposition", "attachment;Filename=" + Upload); 
Response.TransmitFile(Page.MapPath("App_data/OPL/Upload/" + Upload)); 
Response.End(); 

모든 가공 한을 :

ImageButton ibtn = new ImageButton(); 
ibtn.CommandArgument = Upload; 
ibtn.Click += btn_clicked; 
ibtn.ImageUrl = "~/images/download.png"; 
ibtn.ToolTip = "Zeichnung öffnen"; 
gvr.Cells[20].Controls.Add(ibtn); 

버튼이 다운로드를 시작 클릭하면 GRIDVIEW에서 나는 업로드를 볼 수있는 열을 생성 잘 때까지 내가 UpdatePanel에 gridview 넣어. 지금은 오류가 발생합니다 :

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

내가 HttpContext.Current.ApplicationInstance.CompleteRequest();하지만 아무것도 변경되지로 Response.End()를 교체했습니다.

여기에 쓰여진대로 (question) 포스트 백 문제입니다. 솔루션은 것 같습니다

protected void Page_Load(object sender, EventArgs e) { 
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); 
scriptManager.RegisterPostBackControl(this.btnExcelExport); 
//Further code goes here.... 
} 

단추가 생성되어 있고 gridview에 지정되지 않았으므로이 코드를 추가 할 수 없습니다. scriptManager.RegisterPostBackControl(this.btn_Upload);을 추가하려고했지만 버튼을 찾지 못했습니다.

어떻게 해결할 수 있습니까? 감사합니다

답변

1

가능한 해결책은 전체적으로 GridView를 포스트 백 컨트롤로 등록하는 것입니다. ScriptManager.RegisterPostBackControl(this.gvr);

+0

작동, 감사합니다! –