Advertisement

05.29.2008 at 01:15AM PDT, ID: 23440667
[x]
Attachment Details

Datalist and Arraylist

Asked by fosiul01 in Visual Studio .NET 2005, Programming for ASP.NET

Hi this question is similier to bellow 2 questions i asked before

1. http://www.experts-exchange.com/Microsoft/Development/.NET/Visual_Studio_.NET_2005/Q_23416274.html
2.http://www.experts-exchange.com/Microsoft/Development/.NET/Visual_Studio_.NET_2005/Q_23434139.html

In upper 2 questions, i used Text box. and from text box ,I am holding Data in Array list.
but in this question:
I want to do the Samething AGain but problem is, i am using Datalist Control this time.
so, when user will click on ADd button in datalist control , Record would be saved in Array list.

Here, i have declared Arraylist as private,
but dnot know how i will retrive Record from Datalist control.

Please have a look of prevouis question, i want Same solutoin but by using Datalist control.





Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
'''''''''''''
Cartitmes.vb
''''''''''''
 
 
Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Namespace Sample.OopShop.BO
 
Public Class CartItems
#Region "Private Property"
 
        Private _intCartItemID As Integer = -1
        Private _strCartItemName As String = String.Empty
        Private _intCartCost As Integer = -1
        Private _intCartQuantity As Integer = -1
 
#End Region
 
#Region "Public Property"
 
        Public Property CartItemID() As Integer
            Get
                Return _intCartItemID
            End Get
            Set(ByVal value As Integer)
                _intCartItemID = value
            End Set
        End Property
 
        Public Property CartItemName() As String
            Get
                Return _strCartItemName
            End Get
            Set(ByVal value As String)
                _strCartItemName = value
            End Set
        End Property
 
        Public Property CartCost() As Integer
            Get
                Return _intCartCost
            End Get
            Set(ByVal value As Integer)
                _intCartCost = value
            End Set
        End Property
 
        Public Property CartQuantity() As Integer
            Get
                Return _intCartQuantity
            End Get
            Set(ByVal value As Integer)
                _intCartQuantity = value
            End Set
        End Property
#End Region
    End Class
 
End Namespace
 
''''''''''''''''''
index.vb
''''''''''''''''''
Imports System
Imports System.Data
Imports System.Collections.Generic
Imports System.Reflection
Imports System.Web.UI.WebControls
Imports Sample.OopShop.BO
Imports System.Data.OleDb
 
 
Partial Class index
    Inherits System.Web.UI.Page
     Private CartArray As ArrayList ' Declared Arraylist
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
 
 
    Sub AddToCart(ByVal s As Object, ByVal e As DataListCommandEventArgs)
       
        Dim ItemID As Integer = DataList1.DataKeys(e.Item.ItemIndex)
        ' Creating object of CartItems 
        Dim ObjCartItem As CartItems = New CartItems
        ' Bellow code is not hold items comming from Gridview in to this object
        ObjCartItem.CartItemID = Item will come from Datalist<<<<<<<<< here i am stuck <<<<<<<<<<<<<<<<<How i will Retrive Selected Items from Datalist
        ObjCartItem.CartItemName =Item will Come from datalist<<<<<<<<< here i am stuck <<<<<<<<<<<<<How i will Retrive Selected Items from Datalist
 
 
    End Sub
End Class
Attachments:
 
DatalistArraylist
DatalistArraylist
 
 
Loading Advertisement...
 
[+][-]05.29.2008 at 09:05AM PDT, ID: 21670486

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Programming for ASP.NET
Sign Up Now!
Solution Provided By: ApexCo
Participating Experts: 1
Solution Grade: B
 
 
[+][-]05.30.2008 at 12:54AM PDT, ID: 21675910

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628