.Net All About

.Net All About

Statement cannot appear within a method body. End of method assumed


Today when I was developing web pages using asp.net,I encountered a problem as below:
Server Error in ‘/BC30289 Application.

Compilation Error Description:
An error occurred during the compilation of a resource required to service  this request. Please review the following specific error details and modify your  source code appropriately.
Compiler Error Message:
BC30289:  Statement cannot appear within a method body. End of method assumed.

Error Line: Sub showImage(Byval id as string)
I replaced “<% %>” with

<script language=”vbscript” runat=”server”></script>

And then everything works fine.
That is because we cannot define asp ‘sub’ or ‘function’ between the body tag

Happy Programming

November 12, 2009 - Posted by | .NET, Asp.net, HTML, JAVA SCRIPT | , , , ,

1 Comment »

  1. I have tried the same thing defining the function in the head tag but no success.

    Comment by Owolabi Charles | April 9, 2010 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.