|
-
Apr 29th, 2004, 09:13 AM
#1
Thread Starter
Addicted Member
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">
<asp ropDownList ID = "dbox1" Runat =server dir = "rtl" DataTextField = "ProductTitle" DataValueField = "ProductId" ONSELECTEDINDEXCHANGED=dBox1_SelectedIndexChanged" AUTOPOSTBACK="True"/>
</form>
</body>
</HTML>
and it does not work
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|