避免为每个转发器重新加载所有XML数据 - vb.net

Tom*_*Tom 5 xml vb.net asp.net xmlnode itemdatabound

我正在尝试使用xml数据在转发器中放置转发器.我让它完全按照我的意愿工作,但我使用的方法为每个转发器重新加载数据.我想我需要扮演一个XmlNode,但我会说实话 - 我不知道从哪里开始.

这是我的代码 - 如果可能的话,我想保留代码中的所有内容.

<script runat="server">

Public doc As New XmlDocument()

Public Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)

    If Not Page.IsPostBack then

        doc.Load(Server.MapPath("~/myxml/bookstore.xml"))

        Dim nodes As XmlNodeList = doc.SelectNodes("Bookings/Booking[@CLIENT_NO='SA33762']")
        rpMyRepeater.DataSource = nodes
        rpMyRepeater.DataBind()

    End If

End Sub

   Protected Sub itemDB(ByVal s As Object, ByVal e As RepeaterItemEventArgs)
      If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then

         Dim rpt As Repeater = CType(e.Item.FindControl("books"), Repeater)

         If Not (rpt Is Nothing) Then

            doc.Load(Server.MapPath("~/myxml/bookstore.xml"))

            Dim nodes2 As XmlNodeList = doc.SelectNodes("Bookings/Booking[@CLIENT_NO='SA33762']/Products/Book")

            rpt.DataSource = nodes2
            rpt.DataBind()

         End If

      End If
   End Sub

</script>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?