Showing posts with label run. Show all posts
Showing posts with label run. Show all posts

Saturday, March 24, 2012

Please Help - Where is the mistake in my code

Hi all

When I run this app, select the checkbox and press the calculate button i get the following error:

Server Error in '/' 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.] nihe.SimpleRent.calculate(Object source, EventArgs e) +173 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292

My code is as follows, does anyone know what i have done wrong, any help/advice would be very much appreciated.

<%@dotnet.itags.org. Page Language="VB" Debug="true"Inherits="nihe.SimpleRent" ContentType="text/html" ResponseEncoding="iso-8859-1" %><html><body> <form runat="server"> Bathroom with W/C: <asp:CheckBox id="bath_wc" runat="server"></asp:CheckBox> <p> <asp:button id="calcbutton" onclick="calculate" runat="server" text="calculate"></asp:button> </p> </form></body></html>
' SimpleRent.vb'Imports SystemImports System.WebImports System.Web.UIImports System.Web.UI.WebControlsNamespace nihePublic Class SimpleRent : inherits page protected withevents bath_wcAs system.web.ui.webcontrols.checkbox protected withevents row_bwcAs system.web.ui.webcontrols.TableRowPublic sub calculate(source asObject, e as EventArgs) if bath_wc.checked then bath_wc.text ="+3" Context.Items.Add("bath_wc", bath_wc.text) row_bwc.Visible = bath_wc.checked end ifserver.transfer("SimpleResult.aspx")End SubEnd ClassEnd Namespace
<%@dotnet.itags.org. Page Language="vb" %><script runat="server">Sub Page_Load(Source asObject, E as EventArgs) cell_bwc.text ="Bathroom With WC" value_bwc.text = Context.Items("bath_wc")End Sub</script><html><body><form> <asp:Table runat="server"> <asp:TableRow id="row_bwc"> <asp:TableCell id="cell_bwc"></asp:TableCell> <asp:TableCell id ="value_bwc"></asp:TableCell> </asp:TableRow> </asp:Table></form></body></html>

Where did you get this code from?

<html>
<body>
<form>
<asp:Table runat="server">
<asp:TableRow id="row_bwc">
<asp:TableCell id="cell_bwc"></asp:TableCell>
<asp:TableCell id ="value_bwc"></asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>

I see 2 html parts in the code you posted.

Thanks


Because your Calculate method is encapsulated in a page that does not exist. Therefore, "row_bwc" does not exist.

For some reason, it seems you have attempted to create an inheritable base page that is actually a "real" page?


Sorry should have been more specific.

The code show is actaully three seperate pages

page one, codebehind for page one and results page.

Hope this clarifies things

Sorry

Kevin


The last line of your Calculate method attempts to executerow_bwc.Visible = bath_wc.checked. No instance of row_bc has been created. Therefore,row_bc is a null reference.

Remember, there's no row_bc on page one. It's only on the results page.


Lee thanks for reply

So where do i need to reference row_bwc and how do it do it?

Thanks in advance

Kevin


It seems you mix 2 web pages.You have 2 webpages A and B,you can only access controls of A in codebehind of A.

"So where do i need to reference row_bwc and how do it do it?"

You have 2 choice .

1: Combine page one and result page to a single page.That means add:

 <asp:Table runat="server"> <asp:TableRow id="row_bwc"> <asp:TableCell id="cell_bwc"></asp:TableCell> <asp:TableCell id ="value_bwc"></asp:TableCell> </asp:TableRow> </asp:Table>

to page one and don't forget add code in pageload to page one. Then use YourControl.visible to display or hide controls.

2: pass parameter (like row_bwc.Visible,etc )to SimpleResult.aspx then do the action within SimpleResult.aspx.


Kipster:

Lee thanks for reply

So where do i need to reference row_bwc and how do it do it?

Thanks in advance

Kevin

You need to pass the value to set the visibility of row_bwc to the SimpleResult page. You could do this in one of the many ways that you would normally pass values between pages -- like in a QueryString, or drop the Server.Transfer and do a crosspost instead. Let me know if you need an example.

Please help a newbie...

I cannot for the life of me figure out why I cannot run an ASP.NET app. Everytime I try to view in browser/debug I get the error:

maps to a directory outside this application, which is not supported.

I am using Visual Studio 2003. Could someone please enlighten me on what is going wrong here. I am a newbie so if the solution is simple please forgive my ignorance...thanksI have never heard of this error, and it isn't documented in MSDN. My guess is there is a mis-configuration in IIS. Sorry I can't be more specific.
Can you show sources for the page you are trying to view? Especially parts referring to elsewhere (like trying to reference user control etc)

Maybe you can have a look at the following post:

App_GlobalResources maps to a directory outside this application, which is not supported

Hope this helps,

Regards


thanks for posting that link...that is exactly what the problem was. I had a "\" at the end of the file path for the home directory...

thanks again, you saved me

That is so coolBig Smile [:D]

I am happy you solved your problem.

Regards

Wednesday, March 21, 2012

please help me

following error occur while i run my site.
Server Error in '/VEPWEB' Application.
----
--
Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly
'IBA.Common.Controls.WebControls.ScrollableGrid, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=cabd7206fce9d8db' or one of its
dependencies. The system cannot find the file specified.
Source Error:
Line 86: <add assembly="System.Drawing.Design, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 87: <add assembly="System.EnterpriseServices, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 88: <add
assembly="IBA.Common.Controls.WebControls.ScrollableGrid,
Version=1.1.0.0, Culture=neutral, PublicKeyToken=CABD7206FCE9D8DB"/>
Line 89: </assemblies>
Line 90: <buildProviders>
Source File: C:\CheckOut\VEPWeb\web.config Line: 88Check your References folder for missing a assembly, it should have a
warning icon.
It should be 'IBA.Common.Controls.WebControls.ScrollableGrid'.
Delete the reference then re-add it. If that still doesn't work re-compile
'IBA.Common.Controls.WebControls' solution and update the reference.
Regards,
Brian K. Williams
"ggroup" <nimshathameen@.gmail.com> wrote in message
news:1169100986.262250.114500@.38g2000cwa.googlegroups.com...
> following error occur while i run my site.
> Server Error in '/VEPWEB' Application.
> ----
--
> Configuration Error
> Description: An error occurred during the processing of a configuration
> file required to service this request. Please review the specific error
> details below and modify your configuration file appropriately.
> Parser Error Message: Could not load file or assembly
> 'IBA.Common.Controls.WebControls.ScrollableGrid, Version=1.1.0.0,
> Culture=neutral, PublicKeyToken=cabd7206fce9d8db' or one of its
> dependencies. The system cannot find the file specified.
> Source Error:
>
> Line 86: <add assembly="System.Drawing.Design, Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
> Line 87: <add assembly="System.EnterpriseServices, Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
> Line 88: <add
> assembly="IBA.Common.Controls.WebControls.ScrollableGrid,
> Version=1.1.0.0, Culture=neutral, PublicKeyToken=CABD7206FCE9D8DB"/>
> Line 89: </assemblies>
> Line 90: <buildProviders>
>
> Source File: C:\CheckOut\VEPWeb\web.config Line: 88
>

please help me

following error occur while i run my site.

Server Error in '/VEPWEB' Application.
------------------------

Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly
'IBA.Common.Controls.WebControls.ScrollableGrid, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=cabd7206fce9d8db' or one of its
dependencies. The system cannot find the file specified.

Source Error:

Line 86: <add assembly="System.Drawing.Design, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 87: <add assembly="System.EnterpriseServices, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 88: <add
assembly="IBA.Common.Controls.WebControls.ScrollableGrid,
Version=1.1.0.0, Culture=neutral, PublicKeyToken=CABD7206FCE9D8DB"/>
Line 89: </assemblies>
Line 90: <buildProviders>

Source File: C:\CheckOut\VEPWeb\web.config Line: 88Check your References folder for missing a assembly, it should have a
warning icon.
It should be 'IBA.Common.Controls.WebControls.ScrollableGrid'.
Delete the reference then re-add it. If that still doesn't work re-compile
'IBA.Common.Controls.WebControls' solution and update the reference.

Regards,
Brian K. Williams

"ggroup" <nimshathameen@.gmail.comwrote in message
news:1169100986.262250.114500@.38g2000cwa.googlegro ups.com...

Quote:

Originally Posted by

following error occur while i run my site.
>
Server Error in '/VEPWEB' Application.
------------------------
>
Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.
>
Parser Error Message: Could not load file or assembly
'IBA.Common.Controls.WebControls.ScrollableGrid, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=cabd7206fce9d8db' or one of its
dependencies. The system cannot find the file specified.
>
Source Error:
>
>
Line 86: <add assembly="System.Drawing.Design, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 87: <add assembly="System.EnterpriseServices, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 88: <add
assembly="IBA.Common.Controls.WebControls.ScrollableGrid,
Version=1.1.0.0, Culture=neutral, PublicKeyToken=CABD7206FCE9D8DB"/>
Line 89: </assemblies>
Line 90: <buildProviders>
>
>
Source File: C:\CheckOut\VEPWeb\web.config Line: 88
>

please help me soon!

Hi,i upload my aspx files in server that support asp when I try to run pages it dosent show any thing in my system and it shows error about <authentication mode="windows" /> so I set it t
<authentication mode="none" /><!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny acces
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users
--><forms name=".ASPXAUTH
loginUrl="orderdetails.aspx
protection="Validation
timeout="999999" /><authorization

this is a page I want to run . if i new virtual directory in server all the pages are in asp and run and just i have 2 page in .net that want to run in this project does it need have two virtual directory one for asp.net pages and another for asp pages and does it couse problem

If some body can help meFirst what sort of error do you get and second, no you do not need to virtual web servers.
hi this is an error
this is an error to use a section register as allow definition='machine to application' beyond application level.yhis error can be coused by a virtual directory not being configured as an application in iis