BoundColumn does not contain a definition for databinding

Discussion in 'ASP .Net Datagrid Control' started by Ronald Moolenaar, Jan 5, 2005.

  1. 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
    Ronald Moolenaar, Jan 5, 2005
    #1
    1. Advertising

  2. Have a look at this

    http://www.gotdotnet.com/community/messageboard/Thread.aspx?id=21280

    Eliyahu

    "Ronald Moolenaar" <> wrote in
    message news:...
    > 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
    Eliyahu Goldin, Jan 5, 2005
    #2
    1. Advertising

  3. 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?

    "Eliyahu Goldin" wrote:

    > Have a look at this
    >
    > http://www.gotdotnet.com/community/messageboard/Thread.aspx?id=21280
    >
    > Eliyahu
    >
    > "Ronald Moolenaar" <> wrote in
    > message news:...
    > > 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

    >
    >
    >
    Ronald Moolenaar, Jan 7, 2005
    #3
  4. I found a better answer in the next article:

    http://groups.google.com/groups?hl=nl&lr=&selm=#

    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

    "Eliyahu Goldin" wrote:

    > Have a look at this
    >
    > http://www.gotdotnet.com/community/messageboard/Thread.aspx?id=21280
    >
    > Eliyahu
    >
    > "Ronald Moolenaar" <> wrote in
    > message news:...
    > > 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

    >
    >
    >
    Ronald Moolenaar, Jan 7, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Georg Mayer
    Replies:
    2
    Views:
    11,329
    Georg Mayer
    Jun 22, 2004
  2. John
    Replies:
    3
    Views:
    21,569
    Eliyahu Goldin
    Jun 7, 2006
  3. mesut
    Replies:
    0
    Views:
    567
    mesut
    Jun 29, 2007
  4. Earl Teigrob
    Replies:
    1
    Views:
    401
    Shravan
    Mar 1, 2004
  5. Jason Carlton
    Replies:
    11
    Views:
    246
    Dr J R Stockton
    Dec 8, 2009
Loading...

Share This Page