2013-04-30 1 views
0

내 응용 프로그램에 체크 박스가있는 격자보기가 있습니다. 여러 확인란 선택 인쇄 버튼을 클릭하면 별도의 창에서 PDF 파일을 열 수 있습니다. 내 코드는 코드 쇼 위asp.net을 사용하여 새 창에서 여러 PDF 파일을 여는 방법

for (int i = 0; i < grdAdditionalInsured.Rows.Count; i++) 
{ 
    CheckBox chk = (CheckBox)grdAdditionalInsured.Rows[i].Cells[0].FindControl("chkAdditionalInsured"); 

    if (chk.Checked == true) 
    { 
     //**some code to get the id based on values** 
     string file = "/CertPrints/" + id.ToString() + ".pdf"; 
     String js = @"WindowPopup('" + file + "');"; 
     ScriptManager.RegisterStartupScript(this, this.GetType(), file, js, true); 
    } 
} 

만 마지막 레코드 pdf 파일입니다, 저에게 제안을주지하시기 바랍니다.

+0

감사합니다! – bUKaneer

답변

1

이 시도 : 아주 많이 감사 투표까지 받아위한

StringBuilder js = new StringBuilder(); 
for (int i = 0; i < grdAdditionalInsured.Rows.Count; i++) 
{ 
    bool checked = ((CheckBox)grdAdditionalInsured.Rows[i].Cells[0].FindControl("chkAdditionalInsured")).Checked; 
    if (checked) 
    { 
     //**some code to get the id based on values** 
     js.AppendFormat(@"WindowPopup('/CertPrints/{0}.pdf');",id)); 
    } 
} 
ScriptManager.RegisterStartupScript(this, this.GetType(), "filePopup", js.ToString(), true); 
+0

안녕하세요. 이 코드를 사용하려고합니다. 그리고 그것은 놀라운 일을합니다. 문제는 모든 팝업을로드 한 후 내 기본 페이지가 비어있는 것입니다. 팝업이 열리면 메인 페이지가 제대로로드되게하려면 어떻게해야합니까? – jitendragarg