On the Albums.aspx page, the gridview shows all albums, i would like it to only show the latest album, In other words, i would like the user to only see the album they have just created and not all the other albums.
When a new Album is created it's assigned a unique AlbumID which is stored in the first column of the Albums table. Since the newest album will have the highest AlbumID, you can simply sort by AlbumID and use highest
returned ID to list the latest Album.I hope this helps.Regards,Hs2k
I have one more question, How do I only display only the "public" albums to people that are logged in as "friends".Currently,"friends" can see all the albums, like the "Administrator". I only wantfriends to see albums that have been marked as public.
In most of the functions (like GetPhoto, GetAlbums...etc) you'll see the following two lines.
Dim
Filter As
Boolean = Not (HttpContext.Current.User.IsInRole("Friends")
Or HttpContext.Current.User.IsInRole("Administrators"))
command.Parameters.Add(New SqlParameter("@IsPublic", Filter))
That simply says, if the current user is a member of Friends or Administrators the next line which filters for public albums gets disabled in a away.
So you need to remove the HttpContext.Current.User.IsInRole("Friends") out of the above line so it becomes,
Dim Filter As
Boolean = Not (HttpContext.Current.User.IsInRole("Administrators"))
That will make the private albums only appear to the Administrators.
Remember to do the same to all functions in PhotoManager.vb
In most of the functions (like GetPhoto, GetAlbums...etc) you'll see the following two lines.
Dim Filter As
Boolean = Not (HttpContext.Current.User.IsInRole("Friends")
Or HttpContext.Current.User.IsInRole("Administrators"))
command.Parameters.Add(New SqlParameter("@IsPublic", Filter))
That simply says, if the current user is a member of Friends or Administrators the next line which filters for public albums gets disabled in a away.
So you need to remove the HttpContext.Current.User.IsInRole("Friends") out of the above line so it becomes,
Dim Filter As
Boolean = Not (HttpContext.Current.User.IsInRole("Administrators"))
That will make the private albums only appear to the Administrators.
Remember to do the same to all functions in PhotoManager.vb
Cheers,
Hs2K
Any suggestions or ideas as to editing this code to allow me to control the roles from the admin section instead of hard coding it?
Member
3 Points
41 Posts
Need help with Album page in Personal Website Starter Kit
Oct 16, 2007 02:51 PM|fishmore|LINK
On the Albums.aspx page, the gridview shows all albums, i would like it to only show the latest album, In other words, i would like the user to only see the album they have just created and not all the other albums.
Is this possible?
Personal web site
Member
20 Points
22 Posts
Re: Need help with Album page in Personal Website Starter Kit
Oct 16, 2007 07:22 PM|HS2k|LINK
http://www.digitalsnaps.info
Member
3 Points
41 Posts
Re: Need help with Album page in Personal Website Starter Kit
Oct 17, 2007 09:29 AM|fishmore|LINK
Thanks for your help.
I am not sure were to find the sort property.I have searched the the gridview code and can't find it.
I would like to have the highest numbered Album first by default or even better, i would like to only display the highest numbered album..
Member
20 Points
22 Posts
Re: Need help with Album page in Personal Website Starter Kit
Oct 17, 2007 06:01 PM|HS2k|LINK
You’ll need to edit the GetAlbums stored procedure in your database.
To get the sorting you can add the ‘Order By’ command near the end. So your new stored procedure will look like this,
And if you only want to show the first album, then you can use the ‘SELECT TOP 1’ near the start of the GetAlbums stored procedure as below,
SELECT TOP 1 [Albums].[AlbumID], [Albums].[Caption],
Hope that helps,
Hs2K
http://www.digitalsnaps.info
Member
3 Points
41 Posts
Re: Need help with Album page in Personal Website Starter Kit
Oct 18, 2007 11:00 AM|fishmore|LINK
That work great! Thanks.
I have one more question, How do I only display only the "public" albums to people that are logged in as "friends". Currently, "friends" can see all the albums, like the "Administrator". I only want friends to see albums that have been marked as public.
Thanks again for your help
Member
20 Points
22 Posts
Re: Need help with Album page in Personal Website Starter Kit
Oct 18, 2007 05:43 PM|HS2k|LINK
Ok, let's take a look in PhotoManager.vb.
In most of the functions (like GetPhoto, GetAlbums...etc) you'll see the following two lines.
Dim
Filter As Boolean = Not (HttpContext.Current.User.IsInRole("Friends") Or HttpContext.Current.User.IsInRole("Administrators"))command.Parameters.Add(New SqlParameter("@IsPublic", Filter))
That simply says, if the current user is a member of Friends or Administrators the next line which filters for public albums gets disabled in a away.
So you need to remove the HttpContext.Current.User.IsInRole("Friends") out of the above line so it becomes,
Dim Filter As Boolean = Not (HttpContext.Current.User.IsInRole("Administrators"))
That will make the private albums only appear to the Administrators.
Remember to do the same to all functions in PhotoManager.vb
Cheers,
Hs2K
http://www.digitalsnaps.info
Member
3 Points
41 Posts
Re: Need help with Album page in Personal Website Starter Kit
Oct 19, 2007 11:23 AM|fishmore|LINK
Again, That worked great. My site is written in c# but i was able to find what you were talking about. Now my site works perfect.
Thanks again!
None
0 Points
16 Posts
Re: Need help with Album page in Personal Website Starter Kit
Feb 29, 2008 05:05 PM|new2this|LINK
Any suggestions or ideas as to editing this code to allow me to control the roles from the admin section instead of hard coding it?
Using VWD2008 and VB
album permissions