I am trying to set up a panel that appears on a page that prompts a user
to enter in a note. This panel object is initially invisable and appears
when the user clicks on a button. Contained within the panel are a couple
of buttons and a textbox. Code is as follows:
ASPX page:
---
<%@dotnet.itags.org. Page Language="VB" Inherits="CustProfile" src="http://pics.10026.com/?src=CustProfile.vb"
autoeventwireup="False" %>
<html>
<form>
...
<td align="middle">
<asp:Button id="btnAddNote" runat="server" Text="Add New
Note"></asp:Button>
</td>
...
<asp:Panel id="pnlAddNote" style="BORDER-RIGHT: black 1px solid; BORDER-TOP:
black 1px solid; Z-INDEX: 1; BACKGROUND: silver; LEFT: 210px; BORDER-LEFT:
black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP:
265px" runat="server" Width="360px" Visible="False" HorizontalAlign="Left">
<p>
<strong>Add Note:</strong>
</p>
<p align="center">
<asp:TextBox id="txAddNote" runat="server" Columns="35"
AutoPostBack="True" Wrap="True" TextMode="MultiLine" Enabled="True"
Visible="True" Rows="4">Enter Note Here.</asp:TextBox>
</p>
<p align="center">
<asp:Button id="btnSaveNote" runat="server" Text="Save Note"
Enabled="True" Visible="True"></asp:Button>
<asp:Button id="btnCancelNote" runat="server" Text="Cancel"
Enabled="True" Visible="True"></asp:Button>
<br />
<br />
</p>
</asp:Panel>
...
</form>
</html
VB code:
---
Imports ...
Public Class CustProfile
'For PostBack
Inherits Page
Protected txtAddNote as TextBox
Protected pnlAddNote as Panel
Protected WithEvents btnAddNote as Button
...
Private Sub btnAddNote_Click(source as Object, e as EventArgs) Handles
btnAddNote.Click
txtAddNote.Text = ""
pnlAddNote.Visible = True
End Sub
...
End Class
And this is the error message I get which makes no sense to me because the
object is declared and exists in both files.
Browser Msg:
----
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 422:
Line 423: Private Sub btnAddNote_Click(source as Object, e as EventArgs)
Handles btnAddNote.Click
Line 424: txtAddNote.Text = ""
Line 425: pnlAddNote.Visible = True
Line 426: End Sub
Source File: C:\Inetpub\wwwroot\incident\cust\CustProfile.vb Line: 424
If anyone can shed some light on this subject (namely point out what I'm
doing wrong) it would be greatly appreciated.
A. Nonymous (slightly dazed and confused)Please disregard this post.
I think I've found a way using JavaScript.
"A. Nonymous" <anonymous@.hotmail.com> wrote in message
news:2PCdnXTBrr8cIXvcRVn-oQ@.giganews.com...
> Hello,
> I am trying to set up a panel that appears on a page that prompts a
user
> to enter in a note. This panel object is initially invisable and appears
> when the user clicks on a button. Contained within the panel are a couple
> of buttons and a textbox. Code is as follows:
> ASPX page:
> ---
> <%@. Page Language="VB" Inherits="CustProfile" src="http://pics.10026.com/?src=CustProfile.vb"
> autoeventwireup="False" %>
> <html>
> <form>
> ...
> <td align="middle">
> <asp:Button id="btnAddNote" runat="server" Text="Add New
> Note"></asp:Button>
> </td>
> ...
> <asp:Panel id="pnlAddNote" style="BORDER-RIGHT: black 1px solid;
BORDER-TOP:
> black 1px solid; Z-INDEX: 1; BACKGROUND: silver; LEFT: 210px; BORDER-LEFT:
> black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP:
> 265px" runat="server" Width="360px" Visible="False"
HorizontalAlign="Left">
> <p>
> <strong>Add Note:</strong>
> </p>
> <p align="center">
> <asp:TextBox id="txAddNote" runat="server" Columns="35"
> AutoPostBack="True" Wrap="True" TextMode="MultiLine" Enabled="True"
> Visible="True" Rows="4">Enter Note Here.</asp:TextBox>
> </p>
> <p align="center">
> <asp:Button id="btnSaveNote" runat="server" Text="Save
Note"
> Enabled="True" Visible="True"></asp:Button>
>
> <asp:Button id="btnCancelNote" runat="server"
Text="Cancel"
> Enabled="True" Visible="True"></asp:Button>
> <br />
> <br />
> </p>
> </asp:Panel>
> ...
> </form>
> </html>
>
> VB code:
> ---
> Imports ...
> Public Class CustProfile
> 'For PostBack
> Inherits Page
> Protected txtAddNote as TextBox
> Protected pnlAddNote as Panel
> Protected WithEvents btnAddNote as Button
> ...
> Private Sub btnAddNote_Click(source as Object, e as EventArgs) Handles
> btnAddNote.Click
> txtAddNote.Text = ""
> pnlAddNote.Visible = True
> End Sub
> ...
> End Class
>
> And this is the error message I get which makes no sense to me because the
> object is declared and exists in both files.
> Browser Msg:
> ----
> Exception Details: System.NullReferenceException: Object reference not set
> to an instance of an object.
> Source Error:
> Line 422:
> Line 423: Private Sub btnAddNote_Click(source as Object, e as
EventArgs)
> Handles btnAddNote.Click
> Line 424: txtAddNote.Text = ""
> Line 425: pnlAddNote.Visible = True
> Line 426: End Sub
> Source File: C:\Inetpub\wwwroot\incident\cust\CustProfile.vb Line: 424
> If anyone can shed some light on this subject (namely point out what I'm
> doing wrong) it would be greatly appreciated.
> A. Nonymous (slightly dazed and confused)
I figured out the problem:
txtAddNote.Text = "" (empty string) causes the problem
I alternatively used:
txtAddNote.Text = " " (a space)
...and all is well.
Sigh!
"A. Nonymous" <anonymous@.hotmail.com> wrote in message
news:2PCdnXTBrr8cIXvcRVn-oQ@.giganews.com...
> Hello,
> I am trying to set up a panel that appears on a page that prompts a
user
> to enter in a note. This panel object is initially invisable and appears
> when the user clicks on a button. Contained within the panel are a couple
> of buttons and a textbox. Code is as follows:
> ASPX page:
> ---
> <%@. Page Language="VB" Inherits="CustProfile" src="http://pics.10026.com/?src=CustProfile.vb"
> autoeventwireup="False" %>
> <html>
> <form>
> ...
> <td align="middle">
> <asp:Button id="btnAddNote" runat="server" Text="Add New
> Note"></asp:Button>
> </td>
> ...
> <asp:Panel id="pnlAddNote" style="BORDER-RIGHT: black 1px solid;
BORDER-TOP:
> black 1px solid; Z-INDEX: 1; BACKGROUND: silver; LEFT: 210px; BORDER-LEFT:
> black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP:
> 265px" runat="server" Width="360px" Visible="False"
HorizontalAlign="Left">
> <p>
> <strong>Add Note:</strong>
> </p>
> <p align="center">
> <asp:TextBox id="txAddNote" runat="server" Columns="35"
> AutoPostBack="True" Wrap="True" TextMode="MultiLine" Enabled="True"
> Visible="True" Rows="4">Enter Note Here.</asp:TextBox>
> </p>
> <p align="center">
> <asp:Button id="btnSaveNote" runat="server" Text="Save
Note"
> Enabled="True" Visible="True"></asp:Button>
>
> <asp:Button id="btnCancelNote" runat="server"
Text="Cancel"
> Enabled="True" Visible="True"></asp:Button>
> <br />
> <br />
> </p>
> </asp:Panel>
> ...
> </form>
> </html>
>
> VB code:
> ---
> Imports ...
> Public Class CustProfile
> 'For PostBack
> Inherits Page
> Protected txtAddNote as TextBox
> Protected pnlAddNote as Panel
> Protected WithEvents btnAddNote as Button
> ...
> Private Sub btnAddNote_Click(source as Object, e as EventArgs) Handles
> btnAddNote.Click
> txtAddNote.Text = ""
> pnlAddNote.Visible = True
> End Sub
> ...
> End Class
>
> And this is the error message I get which makes no sense to me because the
> object is declared and exists in both files.
> Browser Msg:
> ----
> Exception Details: System.NullReferenceException: Object reference not set
> to an instance of an object.
> Source Error:
> Line 422:
> Line 423: Private Sub btnAddNote_Click(source as Object, e as
EventArgs)
> Handles btnAddNote.Click
> Line 424: txtAddNote.Text = ""
> Line 425: pnlAddNote.Visible = True
> Line 426: End Sub
> Source File: C:\Inetpub\wwwroot\incident\cust\CustProfile.vb Line: 424
> If anyone can shed some light on this subject (namely point out what I'm
> doing wrong) it would be greatly appreciated.
> A. Nonymous (slightly dazed and confused)
0 comments:
Post a Comment