Hi Khansaab,
1. Create a page name "PageA.aspx" use the code 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 id="Head1" 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()" />
- <input type="button" value="Pass VirtualPath to PageB" onclick="passVirtualPath()" />
- <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 setValue() {
- 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;
- }
- return true;
- }
- else {
- alert("Please select a category");
- return false;
- }
- }
-
- function getVirtualPath() {
- setValue()
- }
-
- function passVirtualPath() {
- if (setValue()) {
- window.location = "PageB.aspx?path=" + label1.innerHTML;
- }
- }
-
- </script>
2. Create a page name "PageB.aspx" use the code below
- <%@ Page Language="C#" %>
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <script runat="server">
- protected override void OnLoad(EventArgs e)
- {
- if (Request.QueryString["path"] != null)
- {
- lbVirtualPath.Text = Request.QueryString["path"].ToString();
- }
- 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">
- <div>
- <asp:Label ID="lbVirtualPath" runat="server"></asp:Label>
- </div>
- </form>
- </body>
- </html>
3. Run "PageA.aspx" select a category and than click on the "Pass VirtualPath to PageB" button
Regards,
Ken