Help with translation c# -> vb 
Author Message
 Help with translation c# -> vb

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
  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



Sat, 01 Oct 2005 17:42:16 GMT  
 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

- Show quoted text -

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



Sat, 01 Oct 2005 21:21:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB English -> Japanese translation of application

2. PSUDOCODE HELP >>>>>>>>>>>

3. Excel->VBA->Help->Visual Basic Help

4. PLease help with a C++ to VB translation

5. Urgent help required: C to VB translation

6. Please Help --------->>>>AppLink Problem

7. Basica to VB translation - need help

8. Need help with C translation to VB of UNRAR.DLL Declarations

9. >>>> HELP WITH RUNTIME FILES

10. >>>> Tab Key --- Please Help

11. using The Shell Command >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

12. <<<<<<<<ComboBox>>>>>>>>>>>>

 

 
Powered by phpBB® Forum Software