Problem with white space in url path

5 posts, 0 answers
  1. Vlastimil
    Vlastimil avatar
    4 posts
    Member since:
    Jul 2008

    Posted 12 Jan 2011 Link to this post

    Hallo,
    I have problem with spaces in url path.
    I have Rad Grid with columns like this:
    <telerik:GridHyperLinkColumn DataTextFormatString="Adres" ItemStyle-ForeColor="Orange"
     DataNavigateUrlFields="s_adresar" UniqueName="s_adresar" DataNavigateUrlFormatString="file://///SomeServer/Some Directory With Spaces/{0}" Target="_blank" HeaderText="Adres" DataTextField="s_adresar">
     </telerik:GridHyperLinkColumn>

    I would like to open directory from shared file system in Windows Explorer after click on link in RadGrid, but it doesn't work.
    Right path to directory is file://SomeServer/Some Directory With Spaces/
    but rendered path is  file://SomeServer/Some%20Directory%20With%20Spaces/
    and  this path is for Windows Explorer unknown. I tried to replace spaces in path ( in DataNavigateUrlFormatString property) with some mark entity but without success.
    Can anyone help me  please?
    Thanks
  2. Thomas Salt
    Thomas Salt avatar
    136 posts
    Member since:
    Apr 2005

    Posted 12 Jan 2011 Link to this post

    Pretty sure for a shared file system you'll need to use \\SharedfileSystemName

    So your path should be something like file://\\SharedFileName\Some File Path\
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vlastimil
    Vlastimil avatar
    4 posts
    Member since:
    Jul 2008

    Posted 12 Jan 2011 Link to this post

    Thanks for replay Thomas,
    problem in url path is with space in name of directory, not with  file:// or  file:\\
    If I try to open (click on link in rad grid) for example directory file://SomeServer/SomeDirectoryWithoutSpaces/
    it works good - the directory is opened in windows explorer
    If I try to open directory file://SomeServer/Some Directory With Spaces/ 
    windows explorer can't find this url path, because it is rendered in browser like file://SomeServer/Some%20Directory%20With%20Spaces/ and for windows explorer this path is unknown ( he knows only file://SomeServer/Some Directory With Spaces/ 
     ) I think problem is in url encoding of url path from web page to Windows.
     






  5. Thomas Salt
    Thomas Salt avatar
    136 posts
    Member since:
    Apr 2005

    Posted 12 Jan 2011 Link to this post

    Try changing your GridHyperLinkColumn to a GridTemplateColumn and creating an html anchor in the item template.  It still adds the %20 in, but I was able to navigate to my file.

    <a href=file:////SomeServer/Some File With Spaces....

    that worked for me..let me know if you have any questions.
  6. Rama
    Rama avatar
    1 posts
    Member since:
    Nov 2013

    Posted 10 Mar 2015 Link to this post

                            <telerik:GridTemplateColumn DataField="FileLocation" HeaderText="Folder" UniqueName="gtcExistingDirectory" HeaderStyle-Width="3%"
                                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:HyperLink Target="_new" runat="server" href='<%# "F:\SomeFolder\" + Eval("FileLocation").ToString() %>' >
                                        <asp:Image runat="server" ImageUrl="~/Images/Folder.png" />
                                    </asp:HyperLink>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017