could not select subreport - .rdlc - VS 2010 - visual-studio-2010

I had created many reports with VS 2008. Now starting with VS 2010 for new requirement. Please note I am using .rdlc report
I could add subreport control to the report but could not select the available reports. There is no browse button or a dropdown to choose the available .rdlc report.
When I manually type the report name, the reportviewer doesnt show up any subreport. I dont see any error message on the 'Output' window either.
How do I use subreport with VS 2010? Am I missing anything? Any help is appreciated.
I have SQL 2005/2008 (report services installed), VS 2008, VS 2010 installed on the same PC.

First select sub report from Toolbox and put where you want to show.See the image bellow
Now right click on sub report properties and type your sub report name .
Now You have to create a sub report even handler in your .cs file from where you load your report like that:
public Ctor()
{
string path = HttpContext.Current.Server.MapPath("Your Report path");
ReportViewer1.Reset(); //important
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportViewer1.LocalReport.SubreportProcessing += Process_Subreport;
LocalReport objReport = ReportViewer1.LocalReport;
objReport.ReportPath = path;
// Add Parameter If you need
List<ReportParameter> parameters = new List<ReportParameter>();
parameters.Add(new ReportParameter("Name", Value));
ReportViewer1.LocalReport.SetParameters(parameters);
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ShowPromptAreaButton = false;
ReportViewer1.LocalReport.Refresh();
//Add Datasourdce
ReportDataSource reportDataSource = new ReportDataSource();
reportDataSource.Name = "Datasource Name Used due to report design";
reportDataSource.Value = DataSourceValue;
objReport.DataSources.Add(reportDataSource);
objReport.Refresh();
}
Now Create Even Handler Method to load sub report details.
private void Process_Subreport(object sender, SubreportProcessingEventArgs e)
{
//You can get parameter from main report
int paramname = int.Parse(e.Parameters[0].Values[0].ToString());
//You can also add parameter in sub report if you need like main report
//Now add sub report data source
e.DataSources.Add(new ReportDataSource("DataSource Name",DataSourceValue)));
}
I think it will be works for you.Thank you.

Related

ItemEvent in SAP B1 SDK with a SAP form created in Visual Studio 2015

I truly really need your help.
I want to be able to deal with a Click on an Item on my Form which has been created in Visual Studio 2015
this is my Main Methode :
static void Main(string[] args)
{
try
{
Application oApp = null;
if (args.Length < 1)
{
oApp = new Application();
}
else
{
oApp = new Application(args[0]);
}
Menu MyMenu = new Menu();
MyMenu.AddMenuItems();
oApp.RegisterMenuEventHandler(MyMenu.SBO_Application_MenuEvent);
Application.SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
oApp.Run();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
and this code is automatically generated by Visual studio when i creat a new SAP B1 Project.
now i want to add an ItemEvent to handle some klick events on some Forms.
when i add this to the code :
Application.SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
und of course the Methode SBO_Application_ItemEvent then i got a compiler error in this code line that an object reference is requiered for non-static fields...
what did i miss?
I just want to be able to do something when the User clicks on the Grid in my Form.
A Method to add a click event to a grid on a custom user form,
using Visual Studio and SAP BUSINESS ONE STUDIO:
Open the .b1f file in visual studio designer.
an example form:
Click on the Grid you wish to add the event for and navigate to the properties window
Click the lightening symbol to see the events
Double click the space next to your Desired Event
visual studio should then add the code for the event as required, something similar to the below should appear in code:
private void docRowGrid_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg
pVal, ref bool BubbleEvent)
{
}

Visual Studio Plugin for Team Explorer (TFS) - How to get a selection in query editor?

I am developing a Visual Studio Plugin to extend TFS Query handling (2012 version).
After a lot of (re)search I am almost done.
What the plugin can do is extend the context menu in the Query Editor. There I can add additional filters, this works. But I would like to insert the filter above the selected row in the editor.
I cannot find a possibility to retrieve this selection.
I fetch the current QUeryDocument with
IWorkItemTrackingDocument wtd = GetActiveDocument();
IQueryDocument queryDoc = wtd as IQueryDocument;
public IWorkItemTrackingDocument GetActiveDocument()
{
object _lockToken = new object(); // token used for locking the document
if (DTE.ActiveDocument != null)
{
string activeDocumentMoniker = DTE.ActiveDocument.FullName;
IWorkItemTrackingDocument doc = DocService.FindDocument(activeDocumentMoniker, _lockToken);
if (doc != null)
{
doc.Release(_lockToken);
}
return doc;
}
return null;
}
But IQueryDocument does not seem to have a possibility to get the selected rows. There is a SelectedItemIds-Property, but this property contains the selected work item IDs in the results view, not in the query editor.
Any ideas?
Thanks,
Klaus

Acessing ReportService in ReportServer From Windows Application

Here i have a windowsapplication and a SSRS Report where report is implemented in Report server,and herei try to call that report from a windows application.In my button click i add this code:
string reportName = "Crime_Traking_Report";
reportViewer1.ServerReport.ReportServerCredentials =new ReportServerCredentials("isroScientist", "password12345678", "Nasa");
reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
try
{
reportViewer1.ServerReport.ReportServerUrl = new Uri("http://13.88.91.156/ReportServer");
}
catch (UriFormatException)
{
Console.WriteLine("Bad Url format");
}
reportViewer1.ServerReport.ReportPath = "/iSROReportsStandard/" + reportName;
reportViewer1.ProcessingMode = ProcessingMode.Remote;
reportViewer1.ServerReport.Refresh();
Here definitely i want to pass the credentials to access ,but when i run my application its giving an error like this "ReportServerCredentials has no constructor Defined", what change i want to make in order to pass the credentials successfully through my code.please explain me through code.
The question is has the same solution as your other qustion Error while accessing report service(remote mode) from Report server with in a windows application. See my answer there. The ServerReport.SetDataSourceCredentials Method should be used.

DevExpress XtraReports - How to configure fields from custom datasource

I'm starting using DevExpress XtraReports for the company project. My problem is the following:
I have a stored procedure that extracts the data, given three paramaters: startDay, endDay and developer ID, and this SP is inside a .dbml file.
Following this example http://www.devexpress.com/Support/Center/p/B223095.aspx, we have the this method:
static void report_DataSourceDemanded(object sender, System.EventArgs e)
{
Reports.WeeklyTimesheet report = (Reports.WeeklyTimesheet)sender;
DataClasses1DataContext context = new DataClasses1DataContext();
System.Data.Linq.ISingleResult<WeeklyTimesheetUserReportResult> res = >context.WeeklyTimesheetUserReport(Convert.ToDateTime("2012/01/16"), >Convert.ToDateTime("2012/01/20"), 52);
var result = from orderDetail in res select orderDetail;
report.DataSource = res.ToList();
}
Which is the only way i've found (that works) to pass parameters to the SP for the report.
What can i do so the report comes with the data i am sucessfully bringing but is not binding into the report? The attached images will illustrate this point better.
I have to point that when i made that report in the images, were originally formatted from a dataset using the wizard (hence why is ordered), but i have no idea how i can format it instead using the .dbml file.
Thanks in advance.
http://imgur.com/YQ7RE
XtraReport have xrTables, xrLabel controls, they will let you to create custom report and after that you can bind those cell etc and modify the XRControl bindings of the report in the following manner:
[C#]
...
// Original
//this.xrTableCell14.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
// new DevExpress.XtraReports.UI.XRBinding("Text", null, "Symbols.Description")});
// Modified
this.xrTableCell14.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
new DevExpress.XtraReports.UI.XRBinding("Text", null, "Description")});
...
Refer these links and samples..
Binding a Report to an Entity Framework object at runtime
[ How to
use LINQ to SQL data source to create a Master-Detail report
example

No valid report source is available. in asp.net sap crystal report

I am using Sap Crystal Report in asp.net 2010
It will shows the error no valid report source id available, when i refreshing the report or moving to next page at run time using report viewer tools
and this is my coding,
Dim crdoc5 As New ReportDocument()
Dim crtablogoninfo5 As New TableLogOnInfo
Dim crtabs5 As Tables
If Not IsPostBack Then
crdoc5.Load(Server.MapPath("CrStaffrecruit.rpt"))
Session.Add("CrStaffrecruit", crdoc5)
CrystalReportViewer5.ReportSource = crdoc5
Else
CrystalReportViewer5.ReportSource = Session("CrStaffrecruit")
End If
crdoc5.Load(Server.MapPath("CrStaffrecruit.rpt"))
Dim crconninfo5 As New ConnectionInfo()
rconninfo5.ServerName = "servername"
crconninfo5.DatabaseName = "databasename"
crconninfo5.UserID = "sa"
crconninfo5.Password = ""
crtabs5 = crdoc5.Database.Tables()
For Each crtab5 As CrystalDecisions.CrystalReports.Engine.Table In crtabs5
crtablogoninfo5 = crtab5.LogOnInfo
crtablogoninfo5.ConnectionInfo = crconninfo5
crtab5.ApplyLogOnInfo(crtablogoninfo5)
Next
CrystalReportViewer5.ReportSource = crdoc5
CrystalReportViewer5.RefreshReport()
If any one know pls help me...
Thanks in advance
For this please go through the following link
http://forums.sdn.sap.com/thread.jspa?messageID=10951477&#10951477
Although the following code is in C#, it shouldn't be too difficult to translate it to VB and it should solve your issue:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
//whatever you do when the page is loaded for the first time
//this could even be bindReport();
}
else
{
bindReport();
}
}
public void bindReport()
{
ReportDocument rptDoc = new ReportDocument();
dsSample ds = new dsSample(); // .xsd file name
DataTable dt = new DataTable();
// Just set the name of data table
dt.TableName = "Crystal Report Example";
dt = getMostDialledNumbers(); //This function populates the DataTable
ds.Tables[0].Merge(dt, true, MissingSchemaAction.Ignore);
// Your .rpt file path will be below
rptDoc.Load(Server.MapPath("yourReportFilePath.rpt"));
//set dataset to the report viewer.
rptDoc.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rptDoc;
CrystalReportViewer1.RefreshReport();
//in case you have an UpdatePanel in your page, it needs to be updated
UpdatePanel1.Update();
}
I was experiencing the same problem. In what event are you executing the code you posted? I ask because after much debugging, I discovered that you need to place the code in Page_Load (as opposed to PreRender like I was doing previously...)
Hope this helps.
I have got this problem several times, and the solution is to save the Report Document variable in a session then in the Page_load put the below code:
if (IsPostBack)
{
if (Session["reportDocument"] != null)
{
ReportDocument cr = new ReportDocument();
cr = (ReportDocument)Session["reportDocument"];
CrystalReportViewer1.ReportSource = cr;
CrystalReportViewer1.DataBind();
}
}
NB:
Don't forget to fill the (Session["reportDocument"]) with the Display button.
Go through following link. I resolved same issue with that solution.
http://www.aspsnippets.com/Articles/ASPNet-Crystal-Reports-13-Visual-Studio-2010-CrystalReportViewer-Search-Button-Issue---No-valid-report-source-is-available.aspx

Resources