lundi 24 février 2020

DropDownButton conditional statement with attributes?

I'm having trouble to find out how to check if my DropDownList has the attribute Disabled

Here is my code (of how I declare my DropDownList):

<div class="col-7">
    <asp:DropDownList ID="cmbProperty" runat="server" class="browser-default z-depth-5">
    </asp:DropDownList>
</div>

On page load:

protected void Page_Load(object sender, EventArgs e)
{
    cmbProperty.Attributes.Add("disabled", "disabled");
}

On button click:

protected void btnCheckMyProperty_Click(object sender, EventArgs e)
{
    if(cmbProperty.Enabled == true)
    {
        // I always get a true statement
    }            
}

Someone has a clue about it?

Thank you

Aucun commentaire:

Enregistrer un commentaire