Reputation: 2015
I am trying to check my path using script manager and my code is in App_Code here is my code:
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 = "dev01@pps";
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;
}
but i get following error:
Error The best overloaded method match for 'System.Web.UI.ScriptManager.RegisterStartupScript(System.Web.UI.Page, System.Type, string, string, bool)' has some invalid arguments D:\DMS\DocumentManagement\Track4L\App_Code\ReportConnection.cs 27 13 D:\...\Track4L\
I don't know how this problem will be solved
Upvotes: 0
Views: 2973
Reputation: 148110
I think you are passing first argument of this method the object of your class. Pass it the object of calling page. I hope your problem will be solved.
public ReportDocument ReportCon(System.Web.UI.Page myPage, string path)
{
// your code
ScriptManager.RegisterStartupScript(myPage, typeof(Page), "test", "alert('" + path + "');", true);
}
Upvotes: 3