Datalist retreiving values programatically

  • Thread starter Thread starter SandpointGuy
  • Start date Start date
S

SandpointGuy

Im maintaining an app with a DataList, the first time Ive used this control.
A single row is retrieved from the database and formatted on the screen using
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "<name of
column>")) %>
statements in the .aspx (no controls such as button, etc)
My problem is that I dont know how to go back into the datalist and retrieve
one of the values in the codebehind.
Thanks.
 
This literal content will be represented by an instance of the
DataBoundLiteralControl class. Once you have a reference to the item, you
can read the text as

(item.Controls[0] as DataBoundLiteralControl).Text

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top