Re: Seleceted Category Virtual path..?

  •  12-02-2010, 2:08 AM

    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
View Complete Thread