SSRS - Link not clickable in .net Report Application - asp.net

I have a report that specifies a 'Go to URL' action for a textbox. The URL I am using is simply a field from the dataset, so the expression for the URL is something like "=Fields!URLLinkText.Value". When I deploy the report to SSRS Report Manager, the link works fine. It is clickable and opens the URL. However, when I link to the report from the custom asp.Net Reporting Application, the link is not clickable. The cursor of the mouse does not even change when I hover over the link. It seems like the hyperlink/Go To property of the textbox is completely removed. At first, I thought that this had to be an issue with the configuration of the reporting app, which was disabling external hyperlinks. However, I created another report with just one textbox with a Go To Action to go to www.CNN.com and it worked on both the Report Manager and the Report Application...
Any suggestions?

I was just posting about a possibly related issue. It does not involve any custom reporting app though. http://weblogs.asp.net/mnissen/archive/2009/03/26/reporting-services-does-not-display-hyperlink-for-placeholder-with-go-to-url-action.aspx
A few different options you can try: wrap the link in javascript, try "servername:port" instead of the site name if its internal, or try reversing the slashes like http backslash backslash...

You will need to handle the Hyperlink clicked event for your reportviewer control:
Assign the handler in your reportviewer constructor
YourReportViewerControl.Hyperlink += new HyperlinkEventHandler(YourReportViewerControl_Hyperlink);
void YourReportViewerControl_Hyperlink(object sender, HyperlinkEventArgs e)
{
e.Cancel = true;
System.Diagnostics.Process.Start(e.Hyperlink);
}

Related

SSRS Report Hyperlink Loses Functionality in .net Application

I have an SSRS report that employs RowGroups to group data. One of the fields used in the group is a field that stores a URL as text. I've set a Go To URL action on a textbox which enables it to act as a hyperlink that opens up the URL stored as text in a field (i.e. =Fields!URL.value).
The textbox works fine in BIDS and in Report Manager, but when the report is accessed through our custom .asp Reporting Application, the textbox loses this link functionality. It just becomes text. When the mouse is hovered over the textbox, the cursor does not change. I've created another textbox on the report outside the RowGrouping and configured it the same way, and it works fine in the Report Manager and on the Report Application.
Is there any particular configuration that could be restricting a Go to Action property when in a RowGroup on a Reporting Application? Could this be an issue with the report, or an issue on the Reporting App end?
If you are using the ReportExecutionService check to make sure Javascript is true in the device info parameter?
<DeviceInfo>
<JavaScript>True</JavaScript>
</DeviceInfo>
But you said it worked if it was in another part of the report?
link to <DeviceInfo> Details
Never really found an answer to this problem, but a work around I used was placing a textbox to the right of the grouped textbox, where the link seems to work fine.

New .aspx page in Visual Studio Web Application crashes page

i'm having a WebPart for displaying information about employees and i want to display only a view information about the persons. The rest should be available after clicken on a "more" link. I tried to get that with opening a "popup"window.
But i don't get that to work right. So i tried using a new page. Hence i added a new aspx page to my project in visual studio
and added a link to that page like that:
LinkButton link = new LinkButton(); link.Width = Unit.Pixel(20);
link.Text = "more";
After building the project i tested it in my webpart page and get an error
"An unexpected error occured".
It took me a lot to get the webpart work properly again.
Has anybody an idea what i'm doing wrong. (i also tried to catch an exception without success)
I also tried to add an click event to that "more" link. but then, when i hover above that link with the mouse i see
"javascript:__doPostBack('ctl00$m$g_84d91faf_d0a8_4587_bb7c_712030d2c4ea$ctl00$ctl18','')"
i tried with link.OnClientClick and link.OnClick, nothing works.
I really need that function for that page.
I would highly appreciate it if you can give me a code snippet of a solution.
Thanks in advance
You should use PostBackUrl property of linkbutton Or on button click event you can call Response.Redirect

How to create ASPX Page Dynamically

i have two controls on asp.net page , textbox and button and i want to write new page into textbox then when i hit the button i want to create new asp.net web page with textbox text. what do you want me to prefer to do this? is there any step by step tutorial or any code you have done before? thanks for asnwers.
ok more detail about what i want.
textbox control text is "contact" and i click my button control. button take textbox text "contact" and create new web form page which name is "contact.aspx and its code page contact.cs" . thats it. just create new web form page under root directory with button click.
maybe there is a single code line like
Page pg =new Page();
pg.create();
You can use File.WriteAllText to write the contents of the textbox to any location that the application pool user has permissions to write to.
From your edit it appears that you are looking for a CMS/wiki kind of functionality. There is nothing like that built into the .NET framework.
I suggest you look for wiki software.
No need to worry about big codes etc
You can create it with 2 simple steps explained in my blog
Create one empty page then copy it using Files concept. Save it as what ever name you want.
Try to change the content inside newly created page to Run smoothly
Please visit my blog for example solution
Click here for Solution Post
You can use the Page.ParseControl method.
Beware, it does not support everything you can do with a real ASPX or ASHX file, but it works for simple things. An example is available here: Using Page.ParseControl to add new control from Control Tag
There is very simple way to do that. It is working on principe to Copy one your Page, you should put Page with controls that you want to use on your other pages. So first you need using System.IO; then you need this code
protected void Button1_Click(object sender, EventArgs e)
{
try
{
File.Copy(Server.MapPath("") + "\\Submit.aspx", (Server.MapPath("") + "\\" + TextBox1.Text + ".aspx"));
File.Copy(Server.MapPath("") + "\\Submit.aspx.cs", (Server.MapPath("")+ "\\" + TextBox1.Text + ".aspx.cs"));
Response.Redirect(TextBox1.Text + ".aspx");
}
catch
{
Response.Write("<script>window.alert('This page is taken. Please change name!')</script>");
}
}
As you can see, The page you are coping is called Submit, and new Name of your Page is called like textbox1.text.
I hope that this helped you and anyone else.
enter link description here
Before some time I saw a logical question in a web site in this a person give the problem as like this
“I have one page called First.aspx in my web application, in this page; I have a simple asp.net button control. And I want is, on the click event of that button control, create (render) a new dynamic "page" that can be opened in a new windows or tab”
.
Here we give An Example here to creating a new .aspx page at run time. We also give the option to give page name. The user can give as he/she like. Like Google blogging we make new page at runtime.The new page is not in the website, this page create needs to be created at runtime and needs to be dynamic.

'Go to Report' (drillthrough) action not working in SSRS and ASP.NET

I've recently started working with SSRS 2008 and ASP.Net.
I must develop a report with 3 different levels of detail. So, I decided the best solution was to develop 3 different reports and provide some drill-through mechanism in order to allow navigation. For that, I set the 'Action' property of one of the textboxes to 'Go to report' and set the correct url.
The parameters passed to the report need to be validated first. So, for a matter of flexibility and better user experience I let the user enter the parameters using standard ASP.Net controls. When the user clics on my custom button 'Show report' the following code executes:
ReportViewer2.ServerReport.ReportPath = ".. my report path ..";
ReportViewer2.ServerReport.ReportServerUrl = new Uri(".. my report url ..");
ReportParameter p1 = new ReportParameter("dateStart", dateStart.ToString());
ReportParameter p2 = new ReportParameter("dateEnd", dateEnd.ToString());
ReportViewer2.ServerReport.SetParameters(p1);
ReportViewer2.ServerReport.SetParameters(p2);
ReportViewer2.ServerReport.Refresh();
Then the report is shown, but the links for navigating to the other reports don't work.
You may notice that the parameters added are visible, thus letting me press the 'View Report' button wich is embedded inside the report viewer. If I do so, the report is rendered again and then everithing is Ok. It's like the ReportViewer.ServerReport.Refresh() method is missing something.
That's a problem, because the requirements states that the parameteres need to be hidden.
When I execute the report from inside VS or the Report Server the links work ok, but in those cases I always must press the standard 'View Report' button.
Is this a bug of the ReportViewer control or am I missing something here?
Thanks in advance.
Regards,
Gonzalo.
The report viewer contains an update panel. You must call the Update method of the update panel in the pre-render event of the report viewer:
protected void ReportViewer2_PreRender(object sender, EventArgs e)
{
((UpdatePanel)this.ReportViewer2.Controls[1]).Update();
}

Passing value through querstring without showing the destination page in the URL with ASP.NET web form

I have a small web app being written in ASP.NET, VB.NET , .NET 3.5
I pass a value from default.aspx to demo.aspx using query string. When Go button is clicked the URL will be like this : localhost/demo.aspx?id=4
But I want URL to be sth like this when Go button is clicked : localhost/?id=4 and the id value is passed to demo.aspx so the expected result can be shown. How to get this done if possible without using the routing technique.
This will work only if the web server considers demo.aspx to be the default document. When you load a page without stating the page name (such as you localhost/?id=4 example), the web server will locate a file with a pre-defined name and use it as the default document. Often this file is called default.aspx (or .asp, .htm, .html, .php or something like that). So if you want to load any other page you will need to either state the name, or use URL rewriting techniques.
Modify your go button to link button and set herf = "?id=[id]"
Modify Page_Load event of Default.aspx by using the following code.
public Page_Load(object sender,EventArg e)
{
if(!string.IsNullOrEmpty(Request["id"]))
{
// Using Server.Transfer() function to call Demo.aspx page.
// Client still see "localhost/?id=[id]" at address bar.
Server.Transfer("Demo.aspx?id=" + Request["id"]);
}
}
Something like this?
protected void btnGo_Click (Object sender, EventArgs e)
{
Response.Redirect("localhost/?" + Request.QueryString);
}
Not sure when you want the url to change? Not sure what the routing technique is either. Sorry.
if you want it to work with postbacks, you still need to make sure the webserver is configured with a default document like default.aspx.
in 3.5 sp1 MS finally allows us to set the action attribute of the form.
so on page init you can explicitly set it now
Form1.Action = "/mydirectory/"
Caveat: Some versions of IIS do not allow posting to a directory. (XP IIS for example)

Resources