Pierre,
Yes and no...if you are binding to a DataSet, DataTable or DataView,
Container.DataItem is actually of type DataRowView, from which you can get
the underlying DataTable. The DataTable does indeed know the column names,
but not sure how you figure out which column you want.
ctype(Container.DataItem,
System.Data.DataRowView).DataView.Table.Columns(0) .ColumnName but not
sure how you figure out that you want column 0
That's all I can think of...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Pierre Shirvan" <Pi***********@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
Karl:
I wanted to change the label's text dynamically from code. Does the
DataItem has a property that holds the field name?
Pierre
"Karl Seguin" wrote:
Pierre:
Not sure I understand...
you have this:
<asp:label id="field" runat="server"> </asp:label> : <asp:textbox
id="value" runat="server" text='<%=DataBinder.Eval(Container.DataItem,
"FirstName")%>' />
From what I understand you want to display "FirstName" in the
label...why not simply type in "FirstName" ...clearly you know what the column name
is because you are using it in the text control....
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Pierre Shirvan" <Pierre Sh*****@discussions.microsoft.com> wrote in
message news:3E**********************************@microsof t.com... I have a form with a DataList control with a label control and a text
control in the ItemTemplate section. I can display the data in the text contol
using the DataBinder.Eval method and I also want to display the Field or the
Column title in the Label control.
How can I retrieve the column (field) name from the Container?
TIA