PC Review


Reply
Thread Tools Rate Thread

Accesing bound data in a datalist outside of the itemdatabound or ItemCreated methods

 
 
fig000
Guest
Posts: n/a
 
      22nd Aug 2004
Hi,

I have a datalist with bound data from a database. If I wanted to
access one of the fields I would normally use the itemdatabound event
to access that field on each row.

However in this case I want to be able to click one button (not a
button on each row of the datalist) and have the code run through each
row of the datalist and store the values of the database fields used
in the datalist to a table.

What I have is button click event which looks like this:
------------------------
For Each item As DataListItem In dlDocument.Items
Dim dr As DataRow

dr = dt.NewRow
dr.Item("pending_document_id") =
dlDocument.DataKeys(item.ItemIndex)
dr.Item("pending_document_status") =
CType(item.FindControl("drpStatus"), DropDownList).SelectedItem.Value
dr.Item("pending_title") = databinder.eval(item.DataItem,
"processed")
dt.Rows.Add(dr)
Next
-------------------

The problem is in the use of "databinder.eval" syntax I use to get
the "processed" field for each row. I get a null result for that field
though I know there is data bound to the datalist (I can see it before
I click the button).
I think either I simply don't know the correct syntax for this or
it's not possible to get databound items from a datalist outside of
the itemdatabound event or the itemcreated event.
I also tried to loop through the data table used to bind the
datalist but that didn't seem to work either. I think I'm missing the
point here. Any help would be appreciated.

Thanks,
Neil
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ItemCreated V/s. ItemDataBound rn5a@rediffmail.com Microsoft ASP .NET 3 20th Sep 2007 09:13 AM
Repeater - ItemDataBound and ItemCreated Dennis E. Jones, Jr. Microsoft ASP .NET 4 18th Nov 2005 05:45 PM
Embedded Datalist ItemCreated Event Fires Twice John Boldt Microsoft ASP .NET 0 15th Dec 2004 01:05 AM
Repeater ItemCreated vs ItemDataBound =?Utf-8?B?S2V2aW4gSGVjdG9y?= Microsoft ASP .NET 1 11th Apr 2004 01:23 PM
DataList's ItemCreated event Hardy Wang Microsoft ASP .NET 3 27th Oct 2003 09:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 PM.