By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,327 Members | 849 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,327 IT Pros & Developers. It's quick & easy.

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

P: n/a

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") =
dr.Item("pending_document_status") =
CType(item.FindControl("drpStatus"), DropDownList).SelectedItem.Value
dr.Item("pending_title") = databinder.eval(item.DataItem,

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.

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.