Slut Bamwalla, aka Zinglebert Slaptiback (slutbamwalla) wrote in aspdotnet,
Slut Bamwalla, aka Zinglebert Slaptiback

  • Mood:

Disappearing Controls

Can anyone tell me what the hell VS.NET's problem is that half the time it won't recognize controls if they are inside tables?

I have the following snippet in my .aspx page:
<asp:TableCell ColumnSpan="3" HorizontalAlign="Center">
  <asp:Label Runat="server" ID="lblMessage" ForeColor="Red" Font-Bold="True" />
  <asp:Panel Runat="server" ID="pnlStop" Visible="False">
    <asp:Label Runat="server" ID="Label1" ForeColor="Red" Font-Bold="True">This account is currently on stop.  Override or Delete?</asp:Label>
    <asp:Button Runat="server" ID="btnOverride" Text=" Override " CommandArgument="Override" />
    <asp:Button Runat="server" ID="btnDelete" Text=" Delete " />
  <asp:Panel Runat="server" ID="pnlReason" Visible="False">
    <asp:Label Runat="server" ID="Label2" ForeColor="Red" Font-Bold="True">Reason for deletion:</asp:Label>
    <asp:TextBox Runat="server" ID="txtReason" Width="100" />
    <asp:Button Runat="server" ID="btnContinue" Text=" Continue " CommandArgument="Continue" />
    <asp:Button Runat="server" ID="btnCancel" Text=" Cancel " />

This fits with the codebehind declarations:
Protected WithEvents btnOverride As System.Web.UI.WebControls.Button
Protected WithEvents btnDelete As System.Web.UI.WebControls.Button
Protected WithEvents btnContinue As System.Web.UI.WebControls.Button
Protected WithEvents btnCancel As System.Web.UI.WebControls.Button
Protected WithEvents lblMessage As System.Web.UI.WebControls.Label
Protected WithEvents txtReason As System.Web.UI.WebControls.TextBox
Protected WithEvents pnlStop As System.Web.UI.WebControls.Panel
Protected WithEvents pnlReason As System.Web.UI.WebControls.Panel

So how come when I try to set "pnlStop.Visible = True", it works fine, but when I set "pnlReason.Visible = True", I get "Object reference not set to an instance of an object"? What is the difference between the two?
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.