How do I disable all controls in ASP.NET page?

后端 未结 9 1646
旧时难觅i
旧时难觅i 2020-12-14 08:17

I have multiple dropdownlist in a page and would like to disable all if user selects a checkbox which reads disable all. So far I have this code and it is not working. Any s

9条回答
  •  失恋的感觉
    2020-12-14 09:15

    Put a panel around the part of the page that you want disabled:

       < asp:Panel ID="pnlPage" runat="server" >
          ...
       < /asp:Panel >
    

    Inside of Page_Load:

       If Not Me.Page.IsPostBack Then
          Me.pnlPage.Enabled = False
       End If
    

    ... or the C# equivalent. :o)

提交回复
热议问题