Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
ASP.Net Image Gallery
»
Unable to pass Virtual path
Unable to pass Virtual path
Last post 12-09-2010, 9:35 PM by
Kenneth
. 5 replies.
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
12-03-2010, 6:21 AM
65256
Khansaab
Joined on 11-30-2010
Posts 9
Unable to pass Virtual path
Reply
Quote
Unable to pass virtual path to another page.....
12-05-2010, 7:48 PM
65283
in reply to
65256
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Unable to pass Virtual path
Reply
Quote
Hi Khansaab,
Please refer to
How to: Pass Values Between ASP.NET Web Pages
Regards,
ken
12-06-2010, 8:44 AM
65294
in reply to
65283
Khansaab
Joined on 11-30-2010
Posts 9
Re: Unable to pass Virtual path
Reply
Quote
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
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Unable to pass Virtual path
Reply
Quote
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
12-09-2010, 4:25 AM
65332
in reply to
65303
Khansaab
Joined on 11-30-2010
Posts 9
Re: Unable to pass Virtual path
Reply
Quote
Can i do above process on single button....?
12-09-2010, 9:35 PM
65342
in reply to
65332
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Unable to pass Virtual path
Reply
Quote
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