ASP.Net (VB) Report View Data set Dynamically - asp.net

I am having a hard time with this one and I assume it is something I am missing as always.
I am using Visual Studio Web Express 2012. I have installed Report Builder and Report Viewer 11. I have created a generic report file in the report builder as I can not seem to view any designer view in Visual Studio. Not the issue. I am pulling data from my SQL database as usual and populate a dataset. All is fine from here. I can not seem to get the data to show in the report view but can not figure out what I am missing. I have looked everywhere on the web as well as Stack specifically. I have used some of the sample codes and have gotten the report to now show up but still no data. Any help would be great.
I create a generic report file in report builder. No fields, no title etc., just the generic report. This may be my issue but I can not seem to figure out what I am missing.
On my page load I populate the dataset as always with no problem as I can display the data in a label etc.
I add the report viewer to my page and add the following code to the page load after the dataset fill. I also noted that you must use if page.postback = false as Ajax seems to not like it otherwise and just seems to loop and continue loading forever.
I have tried many different code ideas but found I finally got the report to load (again no data) with the following.
rv1.Reset()
rv1.LocalReport.DataSources.Clear()
Dim rds As New ReportDataSource("DataSet1", tempDS.Tables(0))
rv1.LocalReport.ReportPath = Server.MapPath("\tests\test.rdl")
rv1.LocalReport.DataSources.Add(rds)
rv1.LocalReport.Refresh()
Again this is VB.Net webpage. What am I missing? Thanks in advance.

Did you bind the datasource? Sorry if i'm wrong, but in C# asp.net you need to bind the datasource after using an atribution.

Related

can't show a stimulsoft report more than 1 time

I've created a simple report in vs.net 2008 with stimulsoft report 2013.
I'm using these codes to show report:
StiReport1.RegData(ds)
StiReport1.Render()
StiReport1.Show()
when I click on the button I Can see the report correctly for the first time.
but when i close the reportviewer's Windows and click on that button again the
report is empty (I can see the header or footer but no data loaded on the report)
I think the report data not load again or something saved on cache.
please Help.
Thanks
SOLVED
Try this code. its work for me
StiReport1.Dictionary.DataStore.Clear();
StiReport1.Dictionary.Databases.Clear();
StiReport1.Dictionary.DataSources.Clear();
StiReport1.BusinessObjectsStore.Clear();
StiReport1.RegData(ds)
StiReport1.Dictionary.Synchronize();
StiReport1.Compile();
Try this method:
StiReport1.ResetRenderedState();
The problem solved.
I should just save the report and load it each time:
Dim rpt As Stimulsoft.Report.StiReport = New Stimulsoft.Report.StiReport
rpt.Load("report/MyReport.mrt")
rpt.RegData(ds)
rpt.Render()
rpt.Show()
You need to reset your Viewer before rendering. Use ResetReport() function before Reg and Render codes.

Crystal Reports - Data missing when exporting to (PDF or excel or word)

I'm trying to either print or export some Crystal Reports in asp.net
web application. The reports were made with CR 10.5, get their data
from an SQL Server 2008 database.
When I print or export to PDF, a bunch (but not all) of the fields are
skipped. I've
confirmed that the reports work fine in the viewer and designer, but
not when trying to view or export
1) Some fields are always skipped.
2) The same fields seem to be skipped.
Any suggestion or help is appreciated.
try this...
bind your crystal report viewer in page_init() method or check your page postback event...

c# asp.net report and sub report in report viewer (or reportviewer)

I did all the steps from this waltrought:
http://blogs.msdn.com/b/sqlforum/archive/2011/01/03/walkthrough-add-a-subreport-in-local-report-in-reportviewer.aspx
and when i run it i get the first father report and instead the sub
report i get:
Data retrieval failed for the subreport, 'Subreport5',
located at: C:...
i attach a print screen file
i am using VS2010 framework 3.5.
Can you run the subreport by itself, given the right parameters? If you can't, your problem is that.
If you can run it successfully by itself, double-check that you are passing the parameters correctly to your subreport. Make sure the parameter types match and that you are passing all of them.
Another problem might be that -- if I recall correctly -- when you have a subreport in a local report, you need to provide the data for the subreport programmatically, just as you do with the parent report. There's an event that's raised - SubreportProcessingEvent -- when the subreport is being processed. You write a handler for that event and supply data in the handler. Here's some more information about it: LocalReport.SubReportProcessingEvent. There's a good example on that page.

CurrentWorkItem.ID is correct or not in workflow script editor?

I am using Tridion 2011 SP1, And I am creating workflow like start-->create-->Review-->publish--Stop.
I created and registered the class library, and invoke the C# method using VBscript (Script Editor of WF Tab) as given below.
Option Explicit
Dim workflowHandler
Set workflowHandler= CreateObject("CoreComponentWorkflow.WorkflowHandler")
If Not workflowHandler Is Nothing Then
Call workflowHandler.PublishComponent(Cstr(CurrentWorkItem.ID))
FinishActivity "Published to WIP"
End If
Set workflowHandler= Nothing
Is the above code is correct? I am sure I am able to create object using the below line.
Set workflowHandler= CreateObject("CoreComponentWorkflow.WorkflowHandler")
And currently I am publishing the current item only using the C# code, am calling the C# function as below.
Call workflowHandler.PublishComponent(Cstr(CurrentWorkItem.ID))
After publishing the item, I am finishing the activity using below.
FinishActivity "Published to WIP"
I have checked the above code directly in the server by hard coding the currentworkitem, it was working fine. But when I put the same code in vbscript editor, the item is not published.
Can any one suggest on this?
When you hardcode you might be adding the TCM ID directly so it is working properly, which means that CurrentWorkItem.ID is not the correct API call to get the Component ID. See Igor comment below to get the tcm id.

Scraping ASP.net website: Need to Page through a Gridview using Python Mechanize

I'm trying to scrape an asp.net page where I need to page through the items a list of items that are in a gridview control. I've never used asp.net but have been searching the Net for pointers but now I've hit a brick wall. The page links are of the form:
javascript:__doPostBack('ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems','Page$2')
I'm currently trying to get this working using Mechanize in Python. I initially tried the following, assuming that the VIEWSTATE variables would be handled by mechanize.
br.form.set_all_readonly(False)
br['__EVENTTARGET'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTARGUMENT'] = 'Page$2'
response = br.submit(name="ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$itemLocator$btnItemSearch")
html = br.response().read()
Using a network monitor(Fiddler2), I noticed that two more variables were populated so I added these in too:
br.select_form(nr=0)
br.form.new_control('hidden','ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1',attrs = dict(name='ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1'))
br.form.new_control('hidden','hiddenInputToUpdateATBuffer_CommonToolkitScripts',attrs = dict(name='hiddenInputToUpdateATBuffer_CommonToolkitScripts'))
br.form.new_control('hidden','__ASYNCPOST',attrs = dict(name='__ASYNCPOST'))
br.form.set_all_readonly(False)
br['hiddenInputToUpdateATBuffer_CommonToolkitScripts'] = '1'
br['__ASYNCPOST'] = 'TRUE'
br['ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ScriptManager1'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$SearchResultsUpdatePanel|ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTTARGET'] = 'ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$gridViewItems'
br['__EVENTARGUMENT'] = 'Page$2'
response = br.submit(name="ctl00$ctl00$ctl00$ContentPlaceHolderEverything$ContentPlaceHolderFullWidthContent$ContentPlaceHolderMain$itemLocator$btnItemSearch")
html = br.response().read()
With both of these the html I get back is still for page 1 only.
I think there may be a couple of potential issues:
I'm not sure I'm doing the submit right. There are multiple submit buttons on the page so the one I'm searching for is the "search" button, which is what I previously used to get to the first page. I could see that being why the first page is displayed. If I use br.submit() without a name then it uses another submit control that takes you somewhere else.
When you click a page number in a browser, the gridview control updates without a page reload. As I'm not running Javascript, maybe I can't get that but I would at least expect to be able to get back the data from the POST and parse that.
Any help would be much appreciated!
Managed to to it by building an xmlhttprequest per the answer here:
Using Python and Mechanize to submit form data and authenticate

Resources