Seleceted Category Virtual path..?

Last post 12-05-2010, 7:50 PM by Kenneth. 6 replies.
Sort Posts: Previous Next
  •  12-01-2010, 4:02 AM 65214

    Seleceted Category Virtual path..?

    How to get selected category virtual path ....?
  •  12-02-2010, 2:08 AM 65228 in reply to 65214

    Re: Seleceted Category Virtual path..?

    Hi Khansaab,
     
    Please try the example below
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5.   
    6. <script runat="server">  
    7.     string virtualDirectory = null;  
    8.     protected override void OnLoad(EventArgs e)  
    9.     {  
    10.         using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))  
    11.         {  
    12.             virtualDirectory = provider.VirtualDirectory;  
    13.         }  
    14.         base.OnLoad(e);  
    15.     }  
    16.   
    17. </script>  
    18.   
    19. <html xmlns="http://www.w3.org/1999/xhtml">  
    20. <head runat="server">  
    21.     <title>Untitled Page</title>  
    22. </head>  
    23. <body>  
    24.     <form id="form1" runat="server">  
    25.         Selected Virtual Path :  
    26.         <asp:Label ID="label1" runat="server"></asp:Label><br />  
    27.         <input type="button" value="Get virtual path" onclick="getVirtualPath()" />  
    28.         <DotNetGallery:GalleryBrowser ID="galleryBrowser1" runat="server" AllowEdit="true"  
    29.             Layout="Explorer" />  
    30.         <a href="#" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a>  
    31.     </form>  
    32. </body>  
    33. </html>  
    34.   
    35. <script>  
    36. function getVirtualPath()  
    37. {  
    38.     var label1=document.getElementById('<%= label1.ClientID %>');  
    39.     if(thegallerybrowser.Layout._selectedcategory)  
    40.     {  
    41.         if(thegallerybrowser.Layout._selectedcategory.CategoryID==null)  
    42.         {  
    43.             label1.innerHTML="<%= virtualDirectory%>"+"Category0";  
    44.         }  
    45.         else  
    46.         {  
    47.             label1.innerHTML="<%= virtualDirectory%>"+"Category"+thegallerybrowser.Layout._selectedcategory.CategoryID;  
    48.         }  
    49.           
    50.     }  
    51.     else  
    52.     {  
    53.         alert("Please select a category");  
    54.     }  
    55.  }  
    56. </script> 
     
    Regards,
     
    Ken
  •  12-02-2010, 6:28 AM 65235 in reply to 65228

    Re: Seleceted Category Virtual path..?

    thanks ken its working fine
    but it shows path.
    eg. 
    /MyProject/GalleryFiles/Category2
    and i have folder
    /MyProject/Uploads/Khansaab/Category2
     
    what should i do....?
  •  12-02-2010, 10:24 PM 65247 in reply to 65235

    Re: Seleceted Category Virtual path..?

    Hi Khansaab,
     
    Change the red section below to the path of your gallery folder.
     
    using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))
     
    For example
     
    In my test site I set property "GalleryFolder " like below
     
     galleryBrowser1.GalleryFolder = "~/Photos/Animals";
     
    So the code should be
     
     using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/Photos/Animals"))
     
    Regards,
     
    ken
     
  •  12-02-2010, 11:57 PM 65252 in reply to 65247

    Re: Seleceted Category Virtual path..?

    Thanks ken already i did like this...
     
     like ur e.g.
     
    ~/Photos/Animals
     
    each time according to my friends/user folder name will change through session.....
     
    can write here
     
    ~/Photos/SESSIONValue....
     
     
    at the time of creation of folder its working fine with session...
     
    how i can change path with session according to your code after photos i want to add session....
    using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/Photos/"))
     
    then i will get complete answer thanks a lot.....
     
  •  12-03-2010, 12:24 AM 65253 in reply to 65252

    Re: Seleceted Category Virtual path..?

    Thanks a lot for ur help Ken.. thanks a lot.. i got it..
     
    Unable to paas virtual path to another page.......
  •  12-05-2010, 7:50 PM 65284 in reply to 65253

    Re: Seleceted Category Virtual path..?

    Hi Khansaab,
     
     
    ken
View as RSS news feed in XML