Results 1 to 2 of 2

Thread: using class.vb in asp.NET

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    using class.vb in asp.NET

    i wrote the folowing class named ski.vb
    Public Class Ski
    Private _ProductId As Integer
    Private _ProductTitle As String

    Public Sub New(ByVal i As Integer, ByVal s As String)
    _ProductId = i
    _ProductTitle = s
    End Sub

    Public Overridable ReadOnly Property ProductID()
    Get
    Return _ProductId
    End Get
    End Property

    Public Overridable ReadOnly Property ProductTitle()
    Get
    Return _ProductTitle
    End Get
    End Property
    End Class

    and i want to use it in asp.NET control how can i do that???
    i wrote the folowing asp.NET file

    HTML>
    <HEAD>
    <title>BindingArraysToExtendedObjects</title>
    <script language="vb" runat="server">

    Sub Page_Load(sender as system.Object, e as system.eventargs)
    if NOT IsPostBack then 'First Enterance
    Dim aList as New ArrayList
    dim s as new Ski

    With aList
    .Add(new Ski(1001, "Beni Goren"))
    .Add(new Ski(1002, "Lahav Ron"))
    .Add(new Ski(1003, "Yossi Litani"))
    End With
    dbox1.DataSource = aList
    dbox1.DataBind()
    End If
    End Sub

    Sub dbox1_SelectedIndexChanged(Sender as Object, E as EventArgs)
    Response.Write(dbox1.selectedItem.Value.Tostring())
    End Sub

    </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout" BGCOLOR="www">
    <form runat =server method =post id = "form1">
    <aspropDownList ID = "dbox1" Runat =server dir = "rtl" DataTextField = "ProductTitle" DataValueField = "ProductId" ONSELECTEDINDEXCHANGED=dBox1_SelectedIndexChanged" AUTOPOSTBACK="True"/>
    </form>
    </body>
    </HTML>

    and it does not work

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Are you using Visual Studio or some other IDE?

    If you are using another IDE, then you need to compile the ski class into a dll and then copy it into the /bin folder of you applicaiton, then you can use it.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width