Get Sql Server Reporting Services report description in code - asp.net

I have an ASP.NET web page with a ReportViewer control that dynamically loads a report based on the URL and I want to set the DisplayName for the report from code as well. This name is used as the suggested file name whenever someone exports the report to a file.
Now I'd like to use the report description (which is baked in the report file when it's deployed on Reporting Services) for that name but I don't find a way to retrieve that (other than parsing the XML. I guess this should be possible through the ReportViewer control as well.
Ultimately I could also use the value from a TextBox (generated by an expression) in the report (if I rename it consistently over all reports).
Anyone knows how to get either of those values?

It's a property of the catalog item from the SSRS web service endpoint. You'll need to add a web reference to the ReportService2010 wsdl, and then you'll be able to get a list of CatalogItems. Each of those will have a Description property. Note that this can only be set programatically or via the SSRS management interface, it can't be set in BIDS.
http://msdn.microsoft.com/en-us/library/reportservice2010.catalogitem.description

Related

Give an access instead of sharing a report in GA

I can share access to account, property and view in GA. But when I share a report only its template is shared and the person should setup the report on its own.
So, is it possible to give an access to the reports in view?
Thank you.
Custom reports can only be shared as a template except if someone has access to the property and view you want them to see. In order to share your report without giving them access you'd need to send them an export of the report or build them a Data Studio dashboard.
If the person does have access to the property and view, they can use your template shortlink and them pick the correct view and see your custom report.

How to obtain report URL from SSRS .rdlc report?

I'm looking for a way to obtain the report URL from within an SSRS report that is defined locally in an ASP.NET web application. I've tried using the Globals!ReportServerUrl Built-in field, but its not giving me anything useful ( just shows as #ERROR when I place the value in a text box ). I guess this is to be expected since the report doesn't actually live on report server and is defined locally in the app. Any input would be much appreciated.
Thanks in advance.
As pointed out in the comments, RDLC is rendered "locally". This -confusingly- may be on a server, but will still not have a Report Server URL (which is the cause for the error).
In the report you have no obvious way to find any HttpContext items like the request URL, which you seem to be after.
Simplest solution is probably to create a report parameter #RequestUrl and pass something from the HttpRequest into it.
(There's also Custom Code, which you could try, but I doubt it has access to the request URL.)

Dynamic forms using ASP.NET

I want to design and develop a web base software that enable user to report a problem or discussion using ASP.NET and SQL server.
This application might has many forms. For example Form A for reporting bug for software 1 and etc.
I don't want to create a table for keeping data per form.
Solution that comes to my mind is making UserControl per form. and when user chooses a form application loading target usercontrol.
Now I have challenge for save and restore data that user entered into target usercontrol.
What is your suggestion ?
What do you suggest instead of using UserControl ?
I have also review using XML to keeping forms structures but I think its hard to create UI from XML .
I can not see the difficulty in saving and restoring your data.
If you use user control, then I assume you want to reuse it in other forms as well, or it doesnt make any sense.
Or what you want is to load asp.net controls dynamically?
Then step by step:
Firstly create a proper form page you need, then convert it into several user controls (according the business logic).
Reuse user controls you just converted in other forms based on XML
config files, or URL, or query string or session. In XML you can specify the method name you going to call for saving or retrieving data. (That's the structure of one of projects I worked on)
Hoep it helps.
How to: Convert Web Forms Pages into ASP.NET User Controls

ASP.NET crystal report parameters from query string not working

I am updating an existing reporting system in ASP.NET which uses crystal reports. In the past reports have been given their parameters by session variables, however I now have a need to post them in the web address e.g.
www.mysite.com?reportname=myreport&year=2009
I have grabbed the parameters off using request.querystring as usual and the report generates and the first page looks ok. However as soon as I try to go to the next page on the report viewer toolbar the report errors getting no data.
If I remove the parameters and hard code some values the page works fine. Any ideas if this is a known issue with crystal reports? Is there a way around it?
I'm thinking it's something to do with caching not working when parameters are in the address, have something in the back of my mind about it
It seems to be an issue with crystal reports, it must use the address in some way. I modified my code to put in an intermediate page where the request.querystring variables are put into the session and then the user is forwarded to another page which generates the report.

How to parse PropertyName PropertyValue data?

Two web applications I'm working with are using the ASP.NET membership and each have areas for user information which use this Property name/value storage method in the database.
Here is an example:
PropertyNameValues
publicEmail:S:0:19:yahooIM:S:19:0:timezone:S:19:2:commonName:S:21:4:birthdate:S:25:81:signatureFormatted:S:106:0:gender:S:106:1:fontsize:S:107:1:signature:S:108:0:dateFormat:S:108:15:enableEmoticons:S:123:4:webLog:S:127:0:enablePostPreviewPopup:S:127:5:location:S:132:12:bio:S:144:0:webAddress:S:144:0:interests:S:144:0:icqIM:S:144:0:aolIM:S:144:0:language:S:144:5:occupation:S:149:0:msnIM:S:149:0:
PropertyValues
someemailhere#here.com-6Asia<?xml version="1.0" encoding="utf-16"?>
<dateTime>0001-01-01T00:00:00</dateTime>20ddd, MMM d yyyyTrueFalseTest Testing-US
I can see the jist of how it works, name values show at what length in the property value string to begin grabbing and when to end - but is there an existing function to split these apart into an array or something?
Thanks!
How this works depends on if you are using a "web site" or a "web application" project type. If you are using a regular asp.net web site project, you will have a dynamically generated Profile object you can use to fetch user properties from.
If your application is MVC or a Web Application Project though, you will have to make your own profile object. I recommend you grab the web profile builder. This tool creates the ProfileCommon object that is needed to get at the profile data.
In general, I personally have found through repeated exposure that the Profile provider system supplied in asp.net is quite dreadful for storing actual user information (the kind of stuff you are using it for). The profile provider mechanism is great for stuff like user preferences (stuff usually called personalization) such as "always show details" or "I prefer the green background". The reason is that the profile system only makes the profile data easily accessable within the request of the one user. If you have admin tools that need to read from multiple user's profiles, you will find that performance will quickly degenerate, and getting at the profile data is actually quite difficult.
For these reasons, I recommend that you consider not using the profile system for the kind of data you are storing there. You will be a lot better off rolling your own tables and objects to store and fetch this particular kind of info. But if you never need to access the data for more than one user at a time, the built-in profile stuff is alright.
It looks like you're referring to the ASP.NET Profile system.
Within the code-behind of an aspx page, just use Profile.publicEmail, Profile.yahooIM, etc. There's an automatically generated class that parses that out for you. See the linked article for more details.

Resources