Hi Marshal
Thanks for the reply, but I'm looking at accessing the datalist values from outside of the ItemDatabound event. So what I did was to loop through the datalist like this
dim i as int=
while i<Mydatalist.items.coun
dim str = MyDatalist.Items(i).DataItem("customerid") <-- this does not wor
end whil
In datagrid you can easily do that like this
Dim str = MyDataGrid.Items(i).Cell(0).tex
Is there a way to do this with datalist
----- Marshal Antony wrote: ----
Hi Jenn
You can access the Datalist values of a row like this
In the ItemDataBound event of the DataList
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType =
ListItemType.AlternatingItem)
object row_items=e.Item.DataItem
// If you have a column called customerId
object items = e.Item.DataItem
string str1=Convert.ToString(DataBinder.Eval(row_items,"c ustomerId"))
Additional info
You can find the controls in thge ItemTemplate of your datalist
In ItemDataBound event
eg
((LinkButton)e.Item.FindControl("LinkB")).CommandA rgument=e.Item.ItemIndex.
oString()
This will set the commandargument for the Linkbutton
LinkB
The above code is in C#
You can easily convert it into VB.NET.Let me know if you have an
problems
Hope this helps
Marshal Anton
..NET Develope
http://www.dotnetmarshal.co
"jenn" <an*******@discussions.microsoft.com> wrote in messag
news:C0**********************************@microsof t.com..
Hi Anyone knows how to access to a value of a row in a datalist. Somethin
like this in datagrid Dim str = MyDataGrid.Cell(0).tex I would like something like this Dim str = DataBinder.Eval
but it doesn't work