B
Badass Scotsman
Hello,
I have two files, default.aspx and default.aspx.cs. On my ASPX file I have
the following code:
<aspanel ID="MyPanel" runat="server">
Content Here
</aspanel>
And I want to hide this panel when I run my Button_Click routine, which is
coded within my .CS file as so:
***************************
using blah blah blah;
protected Panel MyPanel;
public void Button_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{
MyPanel.Visible = false;
}
}
***************************
I keep getting the following error:
***************************
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 41: {
Line 42: base.OnInit(e);
Line 43: MyPanel.Visible = false;
Line 44: }
Line 45:
***************************
Im still earning this and I am at a very early stage, any help appreciated,
Gary.
I have two files, default.aspx and default.aspx.cs. On my ASPX file I have
the following code:
<aspanel ID="MyPanel" runat="server">
Content Here
</aspanel>
And I want to hide this panel when I run my Button_Click routine, which is
coded within my .CS file as so:
***************************
using blah blah blah;
protected Panel MyPanel;
public void Button_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{
MyPanel.Visible = false;
}
}
***************************
I keep getting the following error:
***************************
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 41: {
Line 42: base.OnInit(e);
Line 43: MyPanel.Visible = false;
Line 44: }
Line 45:
***************************
Im still earning this and I am at a very early stage, any help appreciated,
Gary.