BoundColumn does not contain a definition for databinding

  • Thread starter Ronald Moolenaar
  • Start date
R

Ronald Moolenaar

Hi,

I am trying to get a datagrid working, but it seems to have a problem with
databinding in a boundcolumn. The error message I get is 'BoundColumn does
not contain a definition for databinding'.

Here is my code:

<asp:DataGrid id="devices" runat="server" datasource='<%# AllDevices %>'>
AutoGenerateColumns=False>
<Columns>
<asp:BoundColumn HeaderText='<%#
translator.GetTranslation("lblIPAddress")%>'/>
</Columns>
</asp:DataGrid>

When changing the boundcolumn to <asp:BoundColumn HeaderText="Test"/> the
datagrid works fine.
Does anyone have any suggestions on this matter?

Thanks in advance,
Ronald
 
R

Ronald Moolenaar

If I understand the reply given in the article below, it says:

You cant use <%# .. %> because the datasource is not yet present.

I don't agree with this, if I have an <asp:Label> outside of a datagrid or
so, I can use this too. And I don't use Container.DataItem, that is linked to
a datasource. So I don't think it has anything to do with the datasource, or
am I still missing something?
 
R

Ronald Moolenaar

I found a better answer in the next article:

http://groups.google.com/groups?hl=nl&lr=&selm=#[email protected]

BoundColumn is derived from System.Web.UI.WebControls.DataGridColumn, which
in its turn is derived directly from System.Object.

Therefore, it is not derived from System.Web.UI.Control, which implements
the IDataBindingsAccessor interface. Implementing this interface means you
can access data-binding expressions at design time.

I don't know why it doesn't derive from System.Web.UI.Control, but it makes
the DataGrid with AutoGenerateColumns=False pretty useless to me.

Cheers,
Ronald
 

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

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top