How to access the controls of an Active Reports (Data Dynamics) - asp.net

The company I work for uses the Active Reports from DataDynamics to generate their reports and they asked me if I could do a web viewer of the reports where you could move the fields around.
So the way I figured I could do this was to load the empty reports (with only the fields like they appear in the designer in VS2012) in divs and use Jquery for the moves than create the report dynamically.
The thing is, I cannot find a way to access the controls of the report. I've been googling hwo to do this for a whole day but I cannot seem to find a solution.
We are using Active Reports 6, VS2012 and vb.net.

Each Section in the report has a Controls collection that reveals the collection of controls in that section. The topic on the Sections collection has a good example of how to programatically add controls to the collection. An excerpt with some comments to help explain is below:
' Insert Group Header and Footer Sections:'
Me.Sections.InsertGroupHF()
' Set some proprties to configure those sections:
CType(Me.Sections("GroupHeader1"), GroupHeader).DataField = "CategoryID"
Me.Sections("GroupHeader1").BackColor = System.Drawing.Color.SlateBlue
Me.Sections("GroupHeader1").CanGrow = True
Me.Sections("GroupHeader1").CanShrink = True
CType(Me.Sections("GroupHeader1"), GroupHeader).RepeatStyle = RepeatStyle.OnPageIncludeNoDetail
Me.Sections("GroupHeader1").Height = 0
' Create a TexBox control & Set some properties to configure that control
Dim txt As New TextBox()
txt.DataField = "CatagoryID"
txt.Location = New System.Drawing.PointF(0.0F, 0)
txt.Width = 2.0F
txt.Height = 0.3F
txt.Style = "font-weight: bold; font-size: 16pt"
' Add the TextBox to the GroupHeader section:
Me.Sections("GroupHeader1").Controls.Add(txt)
The ActiveReports 6 documentation has a walkthrough named Run Time Layouts that builds an entire application that builds a report layout in code. That's a good way to learn exactly how to manipulate a report via code.

#activescott & #Michael, the documentation links changed, but they are still available. For the ActiveReports 6 Documentation go here, and the walkthrough for Run Time Layouts is here.

Related

Change text of PAGE N OF M of mvcgrid.net

I am using mvcgrid.net for showing my information in tables in a mvc project
How ever it is working properly I want to change
Showing 1 to 10 of 27 entries
of footer and
next and previous
texts of grid but I didn't find an API for that , Can anyone help me with this.
I am configuring my Grid as:
GridDefaults gridDefaults = new GridDefaults()
{
RenderingMode = RenderingMode.Controller,
ViewPath = "~/Views/MVCGrid/_Grid.cshtml",
NoResultsMessage = "Sorry, no results were found",
ItemsPerPage = 25,
MaxItemsPerPage = 200
};
and I update the text of anything I need in the _Grid.cshtml file or any custom View I use instead.
Custom Style
To use a custom style for your table, you can implement the IMVCGridRenderingEngine to create your table. Everything you need to populate your table will be given to you in the RenderingModel object. Once you have the implementation, set the property on your grid definition to use your new rendering engine:
gridDef.DefaultRenderingEngine = typeof(CustomHtmlRenderingEngine);
This same method could also be used to create custom export formats.
You can find it from the link.
http://mvcgrid.net/demo/customstyle

ASP.Net (VB) Report View Data set Dynamically

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.

Ask the user for number of file to upload -ASPX

I'm trying to build a website (I learning this whole subject now), and maybe the anwser is very simple.
I am devaloping in ASPX/C#, and I want that in form, there is a select field (<select>)
with option of number of files to upload, the max files to upload is 4.
I want that after I select the number of files, there will be some up;oad fields (in the number that I already chose).
My question is how can I do that? (maybe with javascript of AJAX ? I have no idea how)
Wish for help, Thanks.
I am not sure if this is what you are looking for, but give it a try
Try this:
http://jsfiddle.net/2bZwD/
`$('#select1').change(function(){
var count = $(this).val();
var uploadcount = 0;
$('.upload').each(function(){
if (count > uploadcount)
{
$(this).show('slow');
uploadcount++;
}
else
{
$(this).hide('slow');
}
});
});`
There will be two approach
1) Javascript : Using javascript you can read the max file number and add the Upload html tag on the document . As you are using ASPX , it will not work because when the form was build and viewstate was genetated these fields were not the part. If you will use ASP.NET MVC it will work and you easily using the jquery
2) If you want to use the ASP.NET webform you have to do the AutoPostback equals to true for the dropdown list and then read the value on the Selected Index change event on the server and file upload control on the server side. It has a drawback that it will require full post back. You can use the Updatepanel to do the partial post back and get the file controls in the page.

How to use ReportingCloud in asp.net web site?

Recently I have started to work with SSRS and found ReportingCloud. It says
ReportingCloud provides an open source quality implementation
as an extension of the RDL specification
I haven't found any tutorial/documentation on how to use it in sourceforge or via google search.
Can anyone give an walk-through/example on How to use ReportingCloud?
There is one partial example available at http://sourceforge.net/projects/reportingcloud/forums/forum/1116661/topic/4571059.
The example takes an existing RDL file, parses and executes it and then places the HTML output into an asp.net Literal Control for display in the browser.
That code snippet is repeated here:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("C:\MyFolder\MyReport.rdl");
RDLParser rdlp = new RDLParser(xmlDoc.OuterXml);
rdlp.Parse();
MemoryStreamGen ms = new MemoryStreamGen();
ProcessReport pr = new ProcessReport(rdlp.Report, ms);
pr.Run(null, OutputPresentationType.ASPHTML);
// Dump memory stream (HTML Text) to an out-of-box ASPX Literal control
this.LiteralReportHtml.Text = ms.GetText();
To do this you'll need a reference to ReportingCloud.Engine.
I'm not sure exactly what your bigger goals are but I'd like to draw your attention to another open source project on GitHub called My-FyiReporting https://github.com/majorsilence/My-FyiReporting
Just like ReportingCloud, My-FyiReporting is a fork of FyiReporting (which has gone dormant).
The big difference as far as you are concerned is that My-FyiReporting has ASP.NET samples and an ASP.NET user control link. This might be the fast way to get to what you need.
File ORIGINALPROJECT.TXT from ReportingCloud says:
The ReportingCloud is a fork from the original project fyiReporting
4.1 (http://www.fyireporting.com).
File readme.md from My-FyiReporting says:
My-FyiReporting is a fork of fyiReporting. I cannot stress this
enough. This is a FORK. The main purpose is to make sure that I have a
copy of fyiReporting since that project seems to be dead.

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