Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

error when using <% %>and <script></script> tags

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
-Karl - 15 Jun 2007 08:43 GMT
Couls someone please advise me on this error.  What I am trying to do
is be able to convert an XML document into arrays.  I read that the
subs & functions have to be in <script> tags.

Thanks!

Error:
BC30456: 'Read_DOM' is not a member of
'ASP.maps_examples_xml_to_array_aspx'.
Line 53: <asp:Button Text="Read DOM" OnClick="Read_DOM" runat="server"/

Code:
<%@ Import Namespace="System.Xml" %>

<%
    Dim randNumbers(1) as Integer
    randNumbers(0) = 5

    Dim XMLDocument = New XmlDocument
    Dim NodeReader = New XmlNodeReader(XMLDocument)

        XMLDocument.Load(MapPath("XMLSample.xml"))

    While NodeReader.Read()

        Dim Spaces As String = Indent(NodeReader.Depth)

        If NodeReader.IsStartElement() Then
            DOMOut.Text &= "<br/>" & Spaces & "<b>" & NodeReader.Name & "</b>"
            DOMOut.Text &= " [Depth: " & NodeReader.Depth & "]"
        End If

        If NodeReader.NodeType = XmlNodeType.Text Then
            DOMOut.Text &= "<b>: </b>" & NodeReader.Value
        End If

        'List all trees

            If NodeReader.Depth = 1 Then
                Lbl_Trees.text &= NodeReader.Name & " | "

            End if
    End While

    NodeReader.Close()
%>

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

    Function Indent(Depth As Integer)

        Dim i As Integer
        Dim Spaces As String
        For i = 1 to Depth
        Spaces &= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
        Next
        Return Spaces

    End Function
</script>

<form runat=server>
<asp:Button Text="Read DOM" OnClick="Read_DOM" runat="server"/>
<P>
<asp:Label id="DOMOut" EnableViewState="False" runat="server"/>
<P>
<asp:Label id="Lbl_Trees" EnableViewState="False" runat="server"/>
</form>
Cubaman - 17 Jun 2007 15:48 GMT
> Couls someone please advise me on this error.  What I am trying to do
> is be able to convert an XML document into arrays.  I read that the
[quoted text clipped - 64 lines]
> <asp:Label id="Lbl_Trees" EnableViewState="False" runat="server"/>
> </form>

Well, functions and subs have to be in <script> tags. Anyway, from an
architectural point of view, you are implementing bussines logic in a
page. Whay don't you move this code to another class and make it
reusable from all over the application? And why you don't use code-
behind's visual studio feature to separete code from presentation?
Good luck.
-Karl - 18 Jun 2007 15:55 GMT
On Jun 17, 10:48 am, Cubaman <oscar.acostamonte...@googlemail.com>
wrote:

> > Couls someone please advise me on this error.  What I am trying to do
> > is be able to convert an XML document into arrays.  I read that the
[quoted text clipped - 73 lines]
>
> - Show quoted text -

I am coding this via a notepad like editor.  I don't use VS and I
haven't yet look into code behinds (Somewhat complex right now)
What do you mean by seperate class?
I was wanting to keep this piece together for simplicity of managing
the code.  I am not planning on reusing this code anywhere in my
project but I understand the value of making this a function for
future use.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.