By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,101 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,101 IT Pros & Developers. It's quick & easy.

How To Call Function ...

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.