473,320 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
Nov 21 '05 #1
0 1647

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls...
4
by: jenn | last post by:
Hi Anyone knows how to access to a value of a row in a datalist. Something like this in datagrid Dim str = MyDataGrid.Cell(0).tex I would like something like this Dim str =...
1
by: David W. Simmonds | last post by:
I have a Button in a DataList Footer. I add the click event like this: void Item_DataBound(Object sender, DataListItemEventArgs e) { if(e.Item.ItemType == ListItemType.Footer) { Button ctlSave...
8
by: Nevyn Twyll | last post by:
I have a multi-level datalist setup: DataList1 DataList2 MyGrid I have columns explicitly defined for the grid in the html. Sometimes, On the initial Load() of the Page, I want to add extra...
2
by: Vadivel Kumar | last post by:
I have one datalist which contains one item template. In that, iam printing a value taken from the sql table and one check box. Now, the user will select some checkbox and press a button and that...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
6
by: Paul | last post by:
I am trying to use a DataList and the ItemTemplate. I am binding the Datalist to a SQL query that gives me a list of Items with a Parent Category. I want to loop through all the items, but...
1
by: nick | last post by:
I want to set the visible of pnlEditButton according to current login. However, the control is not a member of this(Page) and FindControl() returns null. protected void Page_Load(object sender,...
2
by: ASP Developer | last post by:
Is it possible to bind a datalist that is inside of a bound datalist? Any help would be greatly appreciated.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.