Question : Compiler Error Message: BC30188: Declaration expected.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Partial Class ABC
   Inherits System.Web.UI.Page

    Dim newStyleSheet As New HtmlLink()
    newStyleSheet.Href = "include/StyleSheet.css"   
    newStyleSheet.Attributes.Add("rel", "stylesheet")    
    newStyleSheet.Attributes.Add("type", "text/css")    
    'Page.Header.Controls.Add(link)

End Class

I want to add a stylesheet in the codebehind using this simple code snippet, my page doesn't have anything else.
I got Declaration expected error when do a 'build page' as well as when 'view in Browser' in localhost.

When I typed in a dot after an object, a contex menu appears with a bunch of object' members, what namespace I should import in this case for newStyleSheet? cause I don't see anything....

what's wrong with my page? Thx

Answer : Compiler Error Message: BC30188: Declaration expected.

Your statements need to be either in a constructor or a method or an event, just can be dangling like there in a class.


Arun
Random Solutions  
 
programming4us programming4us