locked
How to make the checkbox = True for any users where admin will have the option to select True or false RRS feed

  • Question

  • User75903138 posted

    how would I change/add the code to make the checkbox item always check? 

     

    Here's the code I have right now:

    <asp:CheckBox ID="CheckBox1" runat="server" Text="Album is private and non visible to other users"

    Checked='<%#Bind("Private") %>' />

    Some how I need it to past true all the time. I'm doing it this way because if you are a admin you can make the album public but if you are not an admin you are only allow to create private albums.

    Thursday, March 13, 2008 1:49 PM

All replies

  • User2069888697 posted

    You could try to change the insert statement to, I believe as long as the checkbox is disabled it will use the DefaultValue.

     <asp:Parameter Name="private" DefaultValue="True" />

    Then you could add a funtion that enables or disables the checkbox if not admin

        Function IsAdmin() As Boolean
            If User.IsInRole("Administrator") Then
                Return True
            Else
                Return False
            End If
        End Function

     Then change the checkbox and add textbox. You could do another function to not show the label to admin as they would not need to see the text twice. 

    <asp:CheckBox ID="CheckBox1" Enabled='<%#isadmin() %>' Visible='<%#isadmin() %>' runat="server" Text="Album is private and non visible to other users" Checked='<%# Bind("Private") %>' /></td>

    <asp:Label ID="Label1" runat="server" Text="Album is private and non visible to other users"></asp:Label>

    Thursday, March 13, 2008 8:15 PM
  • User75903138 posted

    I tried what you told me to do and it still doesn't check the box. It still set the album as public. Any other suggestions? Thanks for all your help so far.

    Saturday, March 15, 2008 9:26 PM