Last post Jan 25, 2008 01:43 PM by chayglass
Jan 25, 2008 09:35 AM|DennisTheMenace|LINK
On the News/List.aspx asp:Repeater#DataList1
I want to config the set VISIBLE = FALSE on the two buttons Edit and Remove if you are not the owner of the article.
Can someone give me a little guidance?
THANKS IN ADVANCE!!
PS - Swing by... I have my family's website up and running. Just tweaking it now for security. I want everyone in the family to be able to post... but only edit and remove what they have personally done.
Jan 25, 2008 11:39 AM|chayglass|LINK
I would simply compare the author of the article to the currently logged in user, and set the visible property of the button accordingly. You might try an Iif() within your repeater, which functions as follows:
Iif( condition ,
And of course, if you're not using a repeater you could simply do it in the codebehind.
Jan 25, 2008 11:45 AM|DennisTheMenace|LINK
>>compare the author of the article to the currently logged in user
Do you have field names for this? I see things like IsAdmin uses:
IsAdmin = User.IsInRole(
But where would I look for the owner's info and the currently logged in info?
Jan 25, 2008 01:43 PM|chayglass|LINK
The currently logged in user is stored in the HttpContext object, under httpcontext.current.user.identity.name ... you ought to be able to compare that to the article author name, which of course, will be part of the dataitem you're dealing with in the repeater.