RDLC Report hyperlink are not working in browser - c#

I have a problem with hyperlinks in my rdlc report. I configured a tablix's textbox by applying steps in this tutorial.(It seems very easy though)
It seems to hyperlinks are not working in the reportviewer control (I mean when I look to report in browser) but when I export that report to PDF all these links works as shine.
I tried setting enableHyperlinks option to true.
I tried in different browsers.
Any comment on where could I be wrong is appriciated.

I'm not sure if this relates to your specific problem or not, but I have recently discovered that if you set the action to URL, it must be a full URL, and not a relative one.
For instance, if you are setting the URL as
="MyPage.aspx?myprop=" & Fields!SomeProp.Value
The result will be that no hyperlink is actually added to the field.
However if you had something like
="http://localhost/MyPage.aspx?myprop=" & Fields!SomeProp.Value
it should work just fine, because that is a full URL
This, of course, brings up the problem of not knowing where the application is. For instance, if you set this to localhost and then put this on the production server it would probably fail for most people.
In order to handle that scenario, you will need to add a parameter to pass in the base URL from the web page and then add the rest.
= String.Format( _
"{0}/MyPage.aspx?myprop={1}", _
Parameters!BaseUrl.Value, _
Fields!SomeProp.Value _
)

This works fine for me:
I just add a new parameter in my rdlc as #BaseUrl and Use the same index in TextBox Properties > Action > Go To Url and
String.Format("{0}Pages/PageName.aspx?item{1}",Parameters!BaseUrl.Value,Fields!YourField.Value)
and set Perameter as http://localhost:1268/ or ur url...

Related

In C# is there a way to see the code that gets generated via an ASPX page?

I'm looking at code in an XYZ.aspx.cs that pertains to a drop down list. It is:
dt = SessionData.Report_RespondentAnswer(DateTime.Parse(tbFromDate.Text).ToString("yyyy-MM-dd"),
DateTime.Parse(tbToDate.Text).ToString("yyyy-MM-dd"),
SurveyID,
SupplierID,
LK_SurveyStatuses.GetResponseGroup_ResponseCodes(ddlResponseRange.SelectedValue),
LK_SurveyStatuses.GetResponseGroup_ClientResponseCodes(ddlResponseRange.SelectedValue));
And this corresponds to a drop-down that looks like this:
ddlResponseRange.SelectedValue
is this possile?
In your browser, Right Click -> View Source
This will show you the generated markup.
Edit Most browsers also have developer modes which are better for this sort of thing. Chrome for example has a great set of Developer Tools.

TextBox AutoCompleteType.Email not working in chrome

I've set my TextBox AutoCompleteType property to AutoCompleteType.Email it works fine in IE but nothing append in chrome or firefox.
It seems an attribute (vcard_name="vCard.Email") is just rendered in IE. I want to know vcard_name is an attribute just for IE or not? and have another borwsers some attribute like vcard_name?
Thanks,
Most browsers use the name attribute of fields (and sometimes their associated labels) to do autocompletion. As long as your fields have relatively straightforward names ('email', 'firstname', etc.) most browsers should be able to find them. However, the implementation details vary from browser to browser; I'm not sure there's any standard you can adhere to that will guarantee success in all cases.
object:vcard_name is only supported in IE. See here for full support.

DotNetNuke 5 open aspx in new window

Another issue I have in DNN5:
I'm currently creating a module that shows a GridView that has a "Edit" column.
When user clicks on "Edit" column, it should open an edit form in a new window.
This edit form is an ASPX-page inside my module folder and it expects a ModuleId parameter in order to access the module Settings; that part works fine and I'm able to retrieve the Module settings.
However, I still have the following issues:
How can I localize my Labels? I have tried DNN's label control, but no success. I also tried asp:Label with "meta:resourceKey", but it looks like it isn't able to access the local resource file.
It's very annoying to use Aspx-pages in my module since it will operate outside DotNetNuke's context. Does anybody knows an approach that allows me to use PortalModuleBase?
I have tought about displaying a DotNetNuke page in the new window, just by referencing the Control to load. However when I do that, it will show me the full page (so with navigation bar, footer, and so on) and I actually just want to show the control.
Besides, I'm only able to open my Aspx-page by referencing to /DesktopModules/MyModule/Page.aspx instead of DNN's NavigateUrl or so.
Thanks for your replies.
DNN will hide all other modules on the page whenever a control (or ctl=mycontrol) is specified for the page. So,
You should change your code from an ASPX page to an ASCX control.
Add the ascx control to the Module Controls section of your module's Module Definition.
Use DNN's NavigateURL function to generate the link. You'll want to use one of the options where you specify the Control Key (i.e. NavigateURL("edit", "SkinSrc=[G]" + Globals.QueryStringEncode( DotNetNuke.UI.Skins.SkinInfo.RootSkin + "/" + Globals.glbHostSkinFolder + "/" + "No Skin" ))
In the above sample, "edit" is the control key you specified for the control.
Why not load the edit interface in another ASCX file rather than an ASPX page? Check out http://dnnsimplearticle.codeplex.com for some examples in C#. It's a basic article module, but does a lot of useful things from a DNN perspective.
Mate for localization Aspx-pages operating outside DotNetNuke's context i suggest you to do it programatically. It will give you more control and you can debug it if some problem arises.
Like EfficionDave suggest use Control Key (i.e. NavigateURL("edit", "SkinSrc=[G]" + Globals.QueryStringEncode( DotNetNuke.UI.Skins.SkinInfo.RootSkin + "/" + Globals.glbHostSkinFolder + "/" + "No Skin" )) method
/Adnan Zameer
http://www.adnanzameer.com

ASP.Net Hyperlink navigation URL not including server name

This might be a ridiculously easy question, but it has me stumped. I have a web form where I'm trying to create a hyperlink in the code behind to a file server share, e.g. file://myServer/Shared/, but when the page is rendered, the link doesn't include the server name, i.e. file:///Shared/. I don't know why this happens. Any help or insight is appreciated.
UPDATE:
Sure, here is the snippet where the link is being set.
//The link is embedded in a table
HyperLink link = (HyperLink)e.Row.Cells[1].Controls[0];
link.NavigateUrl = #"file://myServer/Shared/";
As a test, I assigned the link to a string value and the link prints the expected url.
string foo = link.NavigateUrl;
//Displays this
"file://myServer/Shared/"
I don't know why this doesn't appear when the link is rendered in the final page.
UPDATE 2:
Ok, so I know I have to set the absolute path in the code-behind, I thought that's what I was doing, but it still won't render correctly.
UPDATE 3:
I followed pjacobs suggestion about setting the test property and it was actually a step in the right direction. I have the following:
link.Text = "link text";
Now the link gets rendered as follows: file:///myServer/Shared. I'm almost there except it gives the extra '/' in front of the server name. I'll keep playing with it, this seems like it should be so simple, I don't understand why ASP.Net renders the URL differently.
You have to set the Text property of the HyperLink... link.Text = "whatever"
Are the resources inside the project? If so:
you need to use ResolveUrl to resolve the "web location" of the resource.
http://msdn.microsoft.com/en-us/library/system.web.ui.control.resolveurl.aspx
if you're using an asp.net control you shouldn't need to use the resolve url, but you need to refer to the location of the file relative to the path of the project.
If not:
Did you give the proper read account to ASP.NET process?
Use a virtual directory?
http://www.dotnetspider.com/tutorials/AspNet-Tutorial-86.aspx

Server.UrlEncode apostrophe(') in Firefox

So I have a Hyperlink called lnkTwitter:
And I'm trying to set the url in the code behind:
lnkTwitter.NavigateUrl = string.Format("http://www.twitter.com/home?status={0}", Server.UrlEncode("I'm Steven"));
When I do that and hover over the link, the url displays correctly in the status bar as "http://www.twitter.com/home?status=I'm+Steven", but the actual url, if I click on the link or look at the link's properties, is "http://www.twitter.com/home?status=I%27m+Steven".
For some reason, this only happens in Firefox; in IE, I am taken to the correct url.
Have you tried to view source code?
If source is ok, then there's no troubles with your code.
Firefox just likes to unescape the urls that it shows. While this can be confusing it should not cause your code or the sites you link to (twitter, in this case) any problems.
If you follow the link and then copy the url and paste it into Notepad or something then you should get the escaped form that was actually used instead of the unescaped form that was displayed.
Uri.EscapeDataString, Uri.EscapeUriString, HttpUtility.UrlEncode and HttpUtility.UrlPathEncode are available to use in C# out of the box, they can not convert all the characters exactly the same way as JavaScript escape function does.
Solution: Use JScript.Net's own implementation. Simply reference the Microsoft.JScript.dll and use the Microsoft.JScript.GlobalObject.escape() method to encode your url.

Categories