locked
Using Panel to set Permissions RRS feed

  • Question

  • User-1901014284 posted

    Hi,

    I am using a panel to submit user permissions, the label list is populating from the database correctly but the checkbox is not displaying next to the label. I have this same function running on another program with no issue. I am opening the Permissions within a modal popup but checked this outside also and the same issue occurs. Is there something I am missing or mistake made?

    HTML:

    <h3>Permissions</h3>
    <asp:panel runat="server" id="rolesContainer">
    </asp:panel>


    C#:

    roles = RoleRepository.GetAll();
    
    string sql;
    SqlCommand cmd;
    
    foreach (var role in roles)
    {
    Label myLabel = new Label();
    
    myLabel.Text = role.description.ToString();
    myLabel.ID = "Label" + role.ID.ToString();
    
    CheckBox chkbx = new CheckBox();
    chkbx.ID = "CheckBox_Role_" + role.ID.ToString();
    chkbx.Text = "";
    
    rolesContainer.Controls.Add(chkbx);
    rolesContainer.Controls.Add(myLabel);
    rolesContainer.Controls.Add(new LiteralControl("<br />"));

    Any help would be greatly appreciated.

    Many thanks 

    Jonny

    Thursday, June 6, 2019 11:28 AM

All replies

  • User475983607 posted

    This is a UI question?  I would take a look at the resulting markup and CSS applied using the browser's dev tools (F12).  You have total control over the HTML rendered to the browser.  

    Thursday, June 6, 2019 11:37 AM
  • User-1901014284 posted

    Thank you mgebhard,

    Using the devtools I have found changing 

    -webkit-appearance: None;
    
    to 
    
    -webkit-appearance: checkbox;

    displays the textbox but when changing this within the CSS the checkbox still do not appear within the panel (please see below my CSS)

    input, select, textarea {
    	-moz-appearance: none;
    	-webkit-appearance: checkbox;
    	-ms-appearance: none;
    	appearance: none;
    }

    I cannot see why this would be happening, would I need to make any further changes to the CSS?


    Many thanks

    Jonny

    Thursday, June 6, 2019 2:20 PM
  • User-1901014284 posted

    Hi mgebhard,

    Thank you for your help, seems as though the browser was caching the page. Tried just refreshing but had to delete the internet history which has resolved the issue.

    Thank you again for all your help.

    Jonny

    Thursday, June 6, 2019 3:02 PM