Unable to pass Virtual path

Last post 12-09-2010, 9:35 PM by Kenneth. 5 replies.
Sort Posts: Previous Next
  •  12-03-2010, 6:21 AM 65256

    Unable to pass Virtual path

    Unable to pass virtual path to another page.....
  •  12-05-2010, 7:48 PM 65283 in reply to 65256

    Re: Unable to pass Virtual path

    Hi Khansaab,
     
     
    ken
  •  12-06-2010, 8:44 AM 65294 in reply to 65283

    Re: Unable to pass Virtual path

    Ken
    u have post process already to get virtual path of directory in label i want to pass that label text to next page...
     
    when i refer that pages label not work with that code...
     
    waiting for your reply
     
    thanks
  •  12-06-2010, 8:57 PM 65303 in reply to 65294

    Re: Unable to pass Virtual path

    Hi Khansaab,
     
    1. Create a page name "PageA.aspx" use the code 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 id="Head1" 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.         <input type="button" value="Pass VirtualPath to PageB" onclick="passVirtualPath()" />  
    29.         <DotNetGallery:GalleryBrowser ID="galleryBrowser1" runat="server" AllowEdit="true"  
    30.             Layout="Explorer" />  
    31.         <a href="" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a>  
    32.     </form>  
    33. </body>  
    34. </html>  
    35.   
    36. <script>    
    37. function setValue() {  
    38.     var label1 = document.getElementById('<%= label1.ClientID %>');  
    39.     if (thegallerybrowser.Layout._selectedcategory) {  
    40.         if (thegallerybrowser.Layout._selectedcategory.CategoryID == null) {  
    41.             label1.innerHTML = "<%= virtualDirectory%>" + "Category0";  
    42.         }  
    43.         else {  
    44.             label1.innerHTML = "<%= virtualDirectory%>" + "Category" + thegallerybrowser.Layout._selectedcategory.CategoryID;  
    45.         }  
    46.         return true;  
    47.     }  
    48.     else {  
    49.         alert("Please select a category");  
    50.         return false;  
    51.     }  
    52. }  
    53.   
    54. function getVirtualPath() {  
    55.     setValue()  
    56. }  
    57.   
    58. function passVirtualPath() {  
    59.     if (setValue()) {  
    60.         window.location = "PageB.aspx?path=" + label1.innerHTML;  
    61.     }  
    62. }  
    63.   
    64. </script> 
     2. Create a page name "PageB.aspx" use the code below
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4.   
    5. <script runat="server">  
    6.     protected override void OnLoad(EventArgs e)  
    7.     {  
    8.         if (Request.QueryString["path"] != null)  
    9.         {  
    10.             lbVirtualPath.Text = Request.QueryString["path"].ToString();  
    11.         }  
    12.         base.OnLoad(e);  
    13.     }  
    14. </script>  
    15.   
    16. <html xmlns="http://www.w3.org/1999/xhtml">  
    17. <head runat="server">  
    18.     <title>Untitled Page</title>  
    19. </head>  
    20. <body>  
    21.     <form id="form1" runat="server">  
    22.         <div>  
    23.             <asp:Label ID="lbVirtualPath" runat="server"></asp:Label>  
    24.         </div>  
    25.     </form>  
    26. </body>  
    27. </html> 
     3. Run "PageA.aspx" select a category and than click on the "Pass VirtualPath to PageB" button
     
    Regards,
     
    Ken
  •  12-09-2010, 4:25 AM 65332 in reply to 65303

    Re: Unable to pass Virtual path

    Can i do above process on single button....?
  •  12-09-2010, 9:35 PM 65342 in reply to 65332

    Re: Unable to pass Virtual path

    Hi Khansaab,
     
    can you explain your requirement on detail?
     
    When click on one button, you want to achieve
     
    1. pass the virtual path to another page.
     
    2. What is requirement 2?
     
    3. ?
     
    Keep me posted.
     
    Regards,
     
    ken
View as RSS news feed in XML