2012-04-19 11 views
0

난 스크립트 관리자를 사용하여 내 경로를 확인하려고 내 코드는 여기를 App_Code에 내 코드입니다 :내 코드에서 ScriptManager 오류가 발생 했습니까?

public ReportDocument ReportCon(string path) 
    { 
     ReportDocument cryRpt = new ReportDocument(); 
     ConnectionInfo info = new ConnectionInfo(); 
     TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); 
     Tables CrTables; 

     info.ServerName = "192.168.1.200"; 
     info.DatabaseName = "Track4L"; 
     info.UserID = "Developers"; 
     info.Password = "[email protected]"; 
     ScriptManager.RegisterStartupScript(this, typeof(Page), "test", "alert('" + path + "');", true); 
     cryRpt.Load(path); 

     CrTables = cryRpt.Database.Tables; 
     foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables) 
     { 
      crtableLogoninfo = CrTable.LogOnInfo; 
      crtableLogoninfo.ConnectionInfo = info; 
      CrTable.ApplyLogOnInfo(crtableLogoninfo); 
     } 
     return cryRpt; 
    } 

하지만 난 오류를 다음 얻을 "System.Web.UI '에 가장 적합한 오버로드 된 메서드 일치 오류가 발생했습니다. ScriptManager.RegisterStartupScript (System.Web.UI.Page, System.Type, string, string, bool) 'D : \ DMS \ DocumentManagement \ Track4L \ App_Code \ ReportConnection.cs 27 13 D : ... \ Track4L \ "

나는이 문제가

+0

그냥 추측하지만, 나는 this'는'System.Web.UI.Page'를 참조하지 않는'걸거야. – Tim

+0

@Tim 그러면 내가해야 할 일 –

+0

@Adil이 권장하는 것을 수행하십시오. 'ReportCon'가 호출되어'Page' 인수와 경로 인수를 취하는 코드의 모든 위치를 업데이트해야합니다. – Tim

답변

3

난 당신이 지나가고 생각 문제는 내 코드에 뭔지 solved.tell 될 것입니다 방법을 모른다 g이 메소드의 첫 번째 인수는 클래스의 객체입니다. 호출 페이지의 객체를 전달하십시오. 나는 당신의 문제가 해결되기를 바랍니다. 위의 코드가 App_Code 폴더에 말했다 이후

public ReportDocument ReportCon(System.Web.UI.Page myPage, string path) 
    { 
     // your code 
     ScriptManager.RegisterStartupScript(myPage, typeof(Page), "test", "alert('" + path + "');", true); 

    } 
+0

친애하는하지만 페이지가 아니기 때문에 App_Code에서 prestent 인 .cs 파일입니다. 내가해야 할 일은 해결책을 말해 달라. –

+0

당신은 당신의 페이지에서이 방법을 부르겠습니까? 그렇다면 ReportDocument ReportCon (이 "원하는 경로") 같은이 메서드에서 페이지 개체를 전달하십시오. – Adil

+0

그러나 많은 다른 페이지에서이 함수를 호출하고 그들은 경로에 대한 단 하나의 인수를 취하고 있습니다. –