473,385 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How To Call Function ...

Hi ,

I have 3 files ,
middle.aspx file include the header.aspx and footer.aspx files .
in each of the include files there is a function and from some reason the
call to the Footer() function from the Header.aspx file works fine
But The Call From The Footer.aspx file to the Header() function doesn't work
bcz of some
Compiler Error Message: BC30188: Declaration expected

Please Advise .

Here is the code :
Middle.aspx
**********
<!--#include file="Header.aspx"-->
Some Code Here ....
<!--#include file="Footer.aspx"-->
Header.aspx
**********
Function Header() As Boolean
'do nothing
Header = True
End Function
Footer.aspx
*********
Function Footer() As Boolean
'do nothing
Footer = True
End Function
--
Best Regards ,

Tiraman :-)
Nov 18 '05 #1
7 2664
Hi Tiranman,

Are the functions "Header" and "Footer" client side functions? If so, you
may not be able to call them in that way. When the function in Header is
executed, the footer's code hadn't been load in client browser (IE).
Therefore, we will get an error. For more information abut included ASPX
page, you may refer to:

HOW TO: Dynamically Include Files in ASP.NET
http://support.microsoft.com/default...;EN-US;q306575

Additonally, if you want to add a header or footer on an ASPX page, you
also can consider add them as ASP.NET web control or iframe component.

hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #2
Hi Luke ,

The Functions Are Server Side and i don't want to use a dynamically includes
..

i want that those 2 files (header & footer) will be in all of my aspx files
and they Page_Upload is in them
which mean that the page will start to work from the Header to the Footer
and when the footer will be process there is a function
that call function which is in the header but as i wrote i m getting error .

Please Advice

10x
"[MSFT]" <lu******@online.microsoft.com> wrote in message
news:UZ**************@cpmsftngxa10.phx.gbl...
Hi Tiranman,

Are the functions "Header" and "Footer" client side functions? If so, you
may not be able to call them in that way. When the function in Header is
executed, the footer's code hadn't been load in client browser (IE).
Therefore, we will get an error. For more information abut included ASPX
page, you may refer to:

HOW TO: Dynamically Include Files in ASP.NET
http://support.microsoft.com/default...;EN-US;q306575

Additonally, if you want to add a header or footer on an ASPX page, you
also can consider add them as ASP.NET web control or iframe component.

hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3
Hi Tiranman,

Can you post more detail code to show how you call the fuctions defined in
Header.aspx and footer.aspx? I have created a simple test project but I
haven't found the problem:

Main.aspx:

<form id="Form1" method="post" runat="server">
<!--#include file="Header.aspx"-->
<!--#include file="Footer.aspx"-->
</form>

Header.aspx:

<script language="vbscript" runat="server">

Function Header() As Boolean
'do nothing
Header = True
End Function

sub buttonclick(sender As Object, e As System.EventArgs)

dim s

TextBox1.Text=Footer()

end sub

</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
&nbsp;
<asp:Button id="Button22" style="Z-INDEX: 101; LEFT: 208px; POSITION:
absolute; TOP: 32px" runat="server"
Text="Button" OnClick="buttonclick"></asp:Button>
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 24px; POSITION:
absolute; TOP: 32px" runat="server"></asp:TextBox>
</body>

Footer.aspx:

<script runat=server language=vbscript>

Function Footer() As Boolean
'do nothing
Footer = True
End Function
sub cc(sender As Object, e As System.EventArgs)

dim bb

bb=header()

end sub

</script>

<body MS_POSITIONING="GridLayout">

<FONT face="ËÎÌå">
<asp:Button id="Button33" style="Z-INDEX: 101; LEFT: 216px; POSITION:
absolute; TOP: 184px" runat="server"
Text="Button" OnClick="cc" ></asp:Button></FONT>

</body>
Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4
Hi Luke ,

i attached 3 aspx files with the problem .

i m getting the following error
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: BC30188: Declaration expected.

Source Error:

Line 4: '------------------------------------
Line 5: Dim bResult As Boolean = False
Line 6: bResult = VerHeader()
Line 7: Response.Write("Header = " & bResult)
Line 8:

good luck :-)

10x

"[MSFT]" <lu******@online.microsoft.com> wrote in message
news:b$*************@cpmsftngxa10.phx.gbl...
Hi Tiranman,

Can you post more detail code to show how you call the fuctions defined in
Header.aspx and footer.aspx? I have created a simple test project but I
haven't found the problem:

Main.aspx:

<form id="Form1" method="post" runat="server">
<!--#include file="Header.aspx"-->
<!--#include file="Footer.aspx"-->
</form>

Header.aspx:

<script language="vbscript" runat="server">

Function Header() As Boolean
'do nothing
Header = True
End Function

sub buttonclick(sender As Object, e As System.EventArgs)

dim s

TextBox1.Text=Footer()

end sub

</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
&nbsp;
<asp:Button id="Button22" style="Z-INDEX: 101; LEFT: 208px; POSITION:
absolute; TOP: 32px" runat="server"
Text="Button" OnClick="buttonclick"></asp:Button>
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 24px; POSITION:
absolute; TOP: 32px" runat="server"></asp:TextBox>
</body>

Footer.aspx:

<script runat=server language=vbscript>

Function Footer() As Boolean
'do nothing
Footer = True
End Function
sub cc(sender As Object, e As System.EventArgs)

dim bb

bb=header()

end sub

</script>

<body MS_POSITIONING="GridLayout">

<FONT face="ËÎÌå">
<asp:Button id="Button33" style="Z-INDEX: 101; LEFT: 216px; POSITION:
absolute; TOP: 184px" runat="server"
Text="Button" OnClick="cc" ></asp:Button></FONT>

</body>
Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



Nov 18 '05 #5
Hi Tiraman,

I studied the code and found the root cause is following code ahdn't been
place in pre-defined function:

Dim bResult As Boolean = False
bResult=VerHeader()
Response.Write("Header = " & bResult)

In Header.ASPX, your code is in Page_Load (a pre-defined sub in asp.net),
so that it can be executed. However, above code hadn't been placed in such
a sub. The error "BC30188: Declaration expected" is for Response object,
not for the function "VerHeader". To test this, you may change above code
to:

Dim bResult As Boolean = VerHeader()

This won't cause the error.

Response/Request object are only avaliable in pre-defined sub like
page_load or Button_Click.

If you need to outpput something in the Header/Footer, I strongly recommend
you use a ASP.NET web cotrol intead a included file.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6
Hi Luke ,

10x for the explanation about the pre-defined sub and so on .
it really work when i m using your example and right now my header hold lots
of general functions which i am
using all of the pages and the footer is empty but if one day i will need it
i will be able to use it without going over the pages and put it there :-)

i will also consider to use the web control as you recommended but first i
need to read about it in order to get a good understanding .

10x again for your help .

bye

Tiraman .
"[MSFT]" <lu******@online.microsoft.com> wrote in message
news:6G**************@cpmsftngxa10.phx.gbl...
Hi Tiraman,

I studied the code and found the root cause is following code ahdn't been
place in pre-defined function:

Dim bResult As Boolean = False
bResult=VerHeader()
Response.Write("Header = " & bResult)

In Header.ASPX, your code is in Page_Load (a pre-defined sub in asp.net),
so that it can be executed. However, above code hadn't been placed in such
a sub. The error "BC30188: Declaration expected" is for Response object,
not for the function "VerHeader". To test this, you may change above code
to:

Dim bResult As Boolean = VerHeader()

This won't cause the error.

Response/Request object are only avaliable in pre-defined sub like
page_load or Button_Click.

If you need to outpput something in the Header/Footer, I strongly recommend you use a ASP.NET web cotrol intead a included file.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #7
You are welcome :)

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
4
by: Dave | last post by:
I have a program that I've written a class for. I need to call the function in the program from the class. When I try to call the function I receive the error, the name xxx does not exist in the...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
5
by: Kurt Van Campenhout | last post by:
Hi, I am trying to get/set Terminal server information in the active directory on a windows 2000 domain. Since the ADSI calls for TS don't work until W2K3, I need to do it myself. I'm fairly...
11
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the...
46
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or...
0
by: Mike S | last post by:
I've seen examples of using the CallWindowProc Windows API function to call functions through their addresses in VB6 -- a clever workaround to emulate C-like function pointer semantics. A...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.