0

这是我尝试过的,但它真的不起作用:

  listMediaType.Enabled = false;

在这里,listMediaType 是列表框控件,当用户不应选择列表框中的值时,我在单选按钮更改事件中禁用它

  <asp:ListBox ID="listMediaType" runat="server" class="form-control" SelectionMode="Multiple" Height="90px" Style="width: 300px"></asp:ListBox>

这是cs文件代码:

protected void RequestMedium_CheckedChanged(object sender, EventArgs e)
{
    if (radioInternal.Checked)
    {
        listMediaType.Enabled = false;

    }
    else if (radioExternal.Checked)
    {
        listMediaType.Enabled = true;

    }
}
4

1 回答 1

1

如果有人正在寻找解决方案,这就是答案:

 listMediaType.Attributes.Add("disabled","");
于 2019-10-18T06:09:10.000 回答