Pete
Databinding one record to DataList is still fine, especially when you want
to take advantage of its editing capabilities. Its data source enumerator
will enumerate its internal templated control just once. You still have
options, though. For example when you wanted to databind one record to let's
say Label control you could use:
<%# DataBinder.Eval (yourDataSet, "YourTable. Rows[0].YourColumn" %>
or using default DataView:
<%# DataBinder.Eval (yourDataSet,
"Tables[YourTable].DefaultView.[0].YourColumn" %>
You could use same technique to data bind to TextBox and allow editing by
updating yourDataSet.Tab les["YourTable"].Rows[0]["YourColumn "] value with
your data adapter.
Different approach would be to construct business model (components) so you
could bind its exposed public properties even directly:
<%# MyComponent.MyP roperty %>
HTH
Radek
"Peter Morris [Droopy Eyes Software]" <support@_nospa m_.com> wrote in
message news:e2******** ******@TK2MSFTN GP12.phx.gbl...
Hi all
When I bind to multiple records I use a DataList. This allows the
web-designer to add code like <%#DataBinder.E val(Container.D ataItem,
"Name")%>
Whenever I want to retrieve a single record from the DB for editing I also
want to allow the designer to use the same technique. At the moment I am
still using a DataList for the single row, but this seems like the wrong
thing to do. How should I be doing it?
--
Pete
=============
http://www.DroopyEyes.com - Delphi source code
Audio compression components, Fast Strings, DIB Controls
Read or write article on just about anything
http://www.HowToDoThings.com