Hi Khansaab,
Please try the example below
- <%@ Page Language="C#" %>
-
- <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <script runat="server">
- string virtualDirectory = null;
- protected override void OnLoad(EventArgs e)
- {
- using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))
- {
- virtualDirectory = provider.VirtualDirectory;
- }
- base.OnLoad(e);
- }
-
- </script>
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Untitled Page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- Selected Virtual Path :
- <asp:Label ID="label1" runat="server"></asp:Label><br />
- <input type="button" value="Get virtual path" onclick="getVirtualPath()" />
- <DotNetGallery:GalleryBrowser ID="galleryBrowser1" runat="server" AllowEdit="true"
- Layout="Explorer" />
- <a href="#" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a>
- </form>
- </body>
- </html>
-
- <script>
- function getVirtualPath()
- {
- var label1=document.getElementById('<%= label1.ClientID %>');
- if(thegallerybrowser.Layout._selectedcategory)
- {
- if(thegallerybrowser.Layout._selectedcategory.CategoryID==null)
- {
- label1.innerHTML="<%= virtualDirectory%>"+"Category0";
- }
- else
- {
- label1.innerHTML="<%= virtualDirectory%>"+"Category"+thegallerybrowser.Layout._selectedcategory.CategoryID;
- }
-
- }
- else
- {
- alert("Please select a category");
- }
- }
- </script>
Regards,
Ken