Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Need to trip whitespace in transformtion View modes: 
User avatar
Member
Member
merete-grape - 2/11/2014 3:59:36 PM
   
Need to trip whitespace in transformtion
Need to remove whitespace from link
<a href="/FOTOGRAFENE/<%# Eval("ArticleName") %>.aspx">

This gives me a link with whitespace:
http://www.mydomain.no/FOTOGRAFENE/FirstName LastName.aspx

but it must be:
http://www.mydomain.no/FOTOGRAFENE/FirstNameLastName.aspx

Thx for any help

Regards
Merete

User avatar
Certified Developer 10
Certified Developer 10
josha-bpstudios - 2/11/2014 4:05:28 PM
   
RE:Need to trip whitespace in transformtion
Have you tried something like this?
<a href="/FOTOGRAFENE/<%# Eval("ArticleName").ToString().Replace(" ","") %>.aspx">

User avatar
Member
Member
merete-grape - 2/11/2014 4:12:28 PM
   
RE:Need to trip whitespace in transformtion
Thx a lot :)

Works perfect!!

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/11/2014 6:39:03 PM
   
RE:Need to trip whitespace in transformtion
Another solution might be to use Eval("NodeAliasPath"). This will give you the full path to the document being rendered. What Kentico does by default is replaces spaces in the document name with a dash (-) to create the URL. So although what Josh provided will work, it might not render the proper URL.

User avatar
Member
Member
merete-midtskog - 2/12/2014 3:01:14 AM
   
RE:Need to trip whitespace in transformtion
Hi FroggEye

This is an article placed under a document called "Presentasjon", but the link will be to a document (with the same name) under parent node ("Fotografene").

Don't think it is possible to use your methode then.

But thx anyway.

:)

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2014 6:32:14 AM
   
RE:Need to trip whitespace in transformtion
Then you'll want to use
Eval("NodeAlias")
This will get you the URL friendly name used for that document. Again, for the reason I mentioned above AND the fact that Kentico will remove/replace any non-url friendly characters in this field whereas the DocumentName or ArticleName fields will allow those non-friendly URL characters.

You can find all the fields available simply by running the view for the corresponding document type. For instance if you're looking for the article fields run:
SELECT *
FROM View_CONTENT_Article_Joined
You can get any doc type's information by following this methodology:

View_<namespace>_<classname>_Joined

User avatar
Member
Member
merete-midtskog - 2/12/2014 7:32:50 AM
   
RE:Need to trip whitespace in transformtion
Thx a lot :)