Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

Error on Shortlist change
Last Post 05/31/2010 2:29 PM by Peter Donker. 3 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Mark Hannig
New Member
New Member
Posts:13


--
05/14/2010 1:39 AM

Hi there.  I am trying to hide the link in the short list for users that are not registered.  In other words, I want everyone to see that the file is there, but only be able to download it if they are logged in.  I keep getting the error "Object reference not set to an instance of an object."  In the "visible" attribute of the placeholder I have tried Request.IsAuthenticated, Me.User.IsInRole("Registered Users"), Me.UserInfo.IsInRole("Registered Users"), Context.Current.User.IsInRole("Registered Users"), and a few others.  When I manually set the property to "true" and "false" it works, so I know the error has to do with the code in the block.  Can you help please?

Here is the code I am using:

 <asp:PlaceHolder ID="plAllowed" runat="server" Visible='<%# Me.User.IsInRole("Registered Users") %>'>
   

     <%#DataBinder.Eval(Container, "DataItem.Title")%>
   

<asp:PlaceHolder ID="plNotAllowed" runat="server" Visible='<%# !Me.User.IsInRole("Registered Users") %>'>
    <%#DataBinder.Eval(Container, "DataItem.Title")%>

 

Thanks in Advance!

Mark Hannig
New Member
New Member
Posts:13


--
05/14/2010 1:59 AM

Sorry... The code didn't come out right.  Trying again:

<asp:PlaceHolder ID="plAllowed" runat="server" Visible='<%# Me.User.IsInRole("Registered Users") %>'>

<%#DataBinder.Eval(Container, "DataItem.Title")%>

<asp:PlaceHolder ID="plNotAllowed" runat="server" Visible='<%# !Me.User.IsInRole("Registered Users") %>'>
<%#DataBinder.Eval(Container, "DataItem.Title")%>

Mark Hannig
New Member
New Member
Posts:13


--
05/14/2010 2:00 AM
Well... that's not working. Basically, I am setting the Visible property of a placeholder to the value of those items mentioned above. Hope that makes sense.
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
05/31/2010 2:29 PM
Hi Mark,

Try using UserId. It's set to -1 if the user is not logged in. And use it without "Me." in front as the ascxs have the nasty habit of having layers in between itself and the codebehind.

Peter
You are not authorized to post a reply.