
Help with translation c# -> vb
Hi,
Here is a link the vb version
http://www.*-*-*.com/ ;EN-US;326338
Ken
------------------------
Quote:
> Hi!
> I'm trying to translate the an sample from Microsoft
> ( http://www.*-*-*.com/ ) to VB.
> We are trying to do a similar thing (nested repeaters that gets data from
> mssql) on a 'real'-webpage for an customer.
> I've got stuck on the part where I add the datasource for the
childRepeater.
> How do I do this in VB?
> Thanks in advance
> / Bengt-Erik
> Nested.aspx:
> Inherits="localhost.Nested"%>
> <HTML>
> <body>
> <form runat="server" ID="Form1">
> <asp:repeater id="parentRepeater" runat="server">
> <itemtemplate>
> <b>
> <%# DataBinder.Eval(Container.DataItem, "au_id") %>
> </b>
> <br>
> --> <asp:repeater id="childRepeater" datasource='<%#
> ((DataRowView)Container.DataItem).Row.GetChildRows("myrelation") %>'
> runat="server">
> <itemtemplate>
> <%# DataBinder.Eval(Container.DataItem, "title_id")%>
> <br>
> </itemtemplate>
> </asp:repeater>
> </itemtemplate>
> </asp:repeater>
> </form>
> </body>
> </HTML>
> Nested.aspx.vb:
> Imports System.Data.SqlClient
> Public Class Nested
> Inherits System.Web.UI.Page
> Protected WithEvents parentRepeater As
System.Web.UI.WebControls.Repeater
Quote:
> Protected WithEvents childRepeater As System.Web.UI.WebControls.Repeater
> #Region " Web Form Designer Generated Code "
> 'This call is required by the Web Form Designer.
> <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> InitializeComponent()
> End Sub
> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Init
> 'CODEGEN: This method call is required by the Web Form Designer
> 'Do not modify it using the code editor.
> InitializeComponent()
> End Sub
> #End Region
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Dim cnn As SqlConnection = New
> SqlConnection("server=(local);database=pubs; Integrated Security=SSPI ;")
> Dim cmd1 As SqlDataAdapter = New SqlDataAdapter("select * from
authors",
> cnn)
> Dim ds As DataSet = New DataSet()
> cmd1.Fill(ds, "authors")
> Dim cmd2 As SqlDataAdapter = New SqlDataAdapter("select * from
> titleauthor", cnn)
> cmd2.Fill(ds, "titles")
> ds.Relations.Add("myrelation", ds.Tables("authors").Columns("au_id"),
> ds.Tables("titles").Columns("au_id"))
> parentRepeater.DataSource = ds.Tables("authors")
> Page.DataBind()
> End Sub
> End Class