Hi globosoft,
1. How can I access, read, write display the "properties" attributes found in the config files shown below?
The example below shows you how the get the properties of photo
- <%@ Page Language="C#" %>
-
- <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>
-
- <script runat="server">
- void Page_Load(object sender, EventArgs e)
- {
- gallery1.AllowEdit = true;
- gallery1.AllowPostComment = true;
- gallery1.AllowShowComment = true;
-
- using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))
- {
-
-
- string[] categoryArray = provider.GetCategoryArray();
- for (int i = 0; i < categoryArray.Length; i++)
- {
-
- string[] photoArray = provider.GetPhotoArray(categoryArray[i]);
- string categoryID = categoryArray[i];
- string photoID;
- for (int j = 0; j < photoArray.Length; j++)
- {
- photoID = provider.GetPhotoArray(categoryArray[i])[j];
- string title;
- string comment;
- int width;
- int height;
- int fileSize;
- string ipaddress;
- string propexpr;
- DateTime time;
- provider.GetPhotoInfo(categoryID, photoID, out title, out comment, out width, out height, out fileSize, out ipaddress, out propexpr, out time);
- label1.Text += (title + "-" + comment + width.ToString() + "-" + height.ToString() + "-" + fileSize.ToString() + "-" + ipaddress + "-" + propexpr + "-" + time.ToString() + "<br/>");
-
- }
-
- }
- }
- }
-
- </script>
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head runat="server">
- <title></title>
- </head>
- <body>
- <form id="form1" runat="server">
- <asp:Label ID="label1" runat="server"></asp:Label>
- <a href="#" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a>
- <DotNetGallery:GalleryBrowser runat="server" ID="gallery1" Width="720" Height="430" />
- </form>
- </body>
- </html>
2. Also, what about userid attribute, can that be accessed?
Can you show me which property you mean? (there is not a userid property in the config file)
3. And how would a developer set username attribute to something other then (Guest)?
Please explain this requirement on detail too.
4. Lastly, I notice that many of the responses show examples where C# is used to access the DotNetGallery. Are there any examples and is it possibly to access the DotNetGallery via VB.NET?
Below is a vb.net example to shows you how to access the property of gallery
- <%@ Page Language="VB" %>
-
- <%@ 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">
-
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
- gallery1.AllowEdit = True
- gallery1.AllowPostComment = True
- gallery1.AllowShowComment = True
- End Sub
- </script>
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Untitled Page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <DotNetGallery:GalleryBrowser runat="server" ID="gallery1" Width="720" Height="430" />
- </div>
- </form>
- </body>
- </html>
Regards,
Ken