Welcome Guest Search | Active Topics | Sign In | Register

error in trivial test of message box Options
lkunstenaar
Posted: Wednesday, June 17, 2009 8:40:02 PM
Rank: Newbie
Groups: Member

Joined: 6/17/2009
Posts: 1
I created a trivial page in my asp.net 2005 app and immediately redirect to it in my startup page.

here is the code page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim button As MsgBoxButton = Nothing
MsgBox1.MsgBoxButtonType = MsgBoxButtonType.PushButton
MsgBox1.Show("Hello", "This is a test message", Nothing, button)
End Sub


here is the control
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<eo:MsgBox ID="MsgBox1" runat="server" AllowResize="True" BorderColor="#335C88" BorderStyle="Solid"
BorderWidth="1px" CloseButtonUrl="00070101" ControlSkinID="None" HeaderHtml="Dialog Title"
Height="200px" MinimizeButtonUrl="00070102" ResizeImageUrl="00020014" RestoreButtonUrl="00070103"
ShadowColor="LightGray" ShadowDepth="3" Width="300px">
<HeaderStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 11px; background-image: url(00070104); padding-bottom: 3px; padding-top: 3px; font-family: tahoma" />
<FooterStyleActive CssText="background-color: #e5f1fd; padding-bottom: 8px;" />
<ContentStyleActive CssText="border-top: #335c88 1px solid; background-color: #e5f1fd" />
</eo:MsgBox>

</div>
</form>
</body>
</html>


The app compiles but when I run I get:

Server Error in '/SIU_FI' Application.


Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
EO.Web.Dialog.a() +1332
EO.Web.WebControlBase.a(Object A_0, EventArgs A_1) +43
EO.Web.Internal.a.a(Page A_0, HtmlTextWriter A_1, Boolean A_2) +2142
EO.Web.Internal.fz.a(Page A_0, HtmlTextWriter A_1, Boolean A_2) +51
EO.Web.Internal.by.d(HtmlTextWriter A_0) +70
EO.Web.Dialog.b(HtmlTextWriter A_0) +109
EO.Web.WebControlBase.n(HtmlTextWriter A_0) +71
EO.Web.WebControlBase.a(HtmlTextWriter A_0) +196
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +59
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +68
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +37
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558

can you assist?




Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Code: HTML/ASPX
eo_support
Posted: Wednesday, June 17, 2009 8:49:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

This is normal. When you show a message box, you need to give it at least one button (the forth parameter and on) because if you don't have a button in your message box, then the message box is useless. Usually if you only want to show a message, you should put an OK button there.

In your case, the button you passed in is "Nothing" (because you set "button" to "Nothing" in the first line). That's why the code fails. You need to use "Dim button As MsgBoxButton = new EO.Web.MsgBoxButton(.....)" to initialize the button.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.