Page_Load subroutine

  • Thread starter Thread starter Yongsub Eric Shin
  • Start date Start date
Y

Yongsub Eric Shin

Hi all.

Just one question about Page_Load subroutine

I have the following code

<script runat="server">
Sub Page_Load
if Not Page.IsPostBack then
dim mycountries=New ArrayList
mycountries.Add("Norway")
mycountries.Add("Sweden")
mycountries.Add("France")
mycountries.Add("Italy")
end if
end sub
</script>

and after all, i have this <asp:blahblah- /> line to
display the elements in the array.

but everytime when i looked at this page, i don't see any
of the displays..

i also tried

sub Page_load
msg1.text = "welcome"
end sub

and..<asp:label id = "msg1" runat ="server">

but the text "welcome" does not show up.

What's wrong with this?

I need this really badly right now
Thank you all
 
Hi,

1) your function is missing eventhandler delegator parameters.
2) you need to declare which event this function is handle.

<script runat="server">
Sub Page_Load(ByVal sender as System.Object, ByVal e as
System.EventArgs) Handels MyBase.Load

end sub
....


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
Back
Top