Help with DataColumn.Expression

Discussion in 'ASP .Net Datagrid Control' started by Lee Franke, Oct 14, 2003.

  1. Lee Franke

    Lee Franke Guest

    Lee Franke, Oct 14, 2003
    #1
    1. Advertising

  2. Lee Franke

    Prasad Guest

    Hi

    Please post your code so that it will be easy to fix.

    Prasad

    "Lee Franke" <> wrote in message
    news:...
    > I'm trying to implement Child.ColumnName as in this example.
    >
    >

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
    frlrfsystemdatadatacolumnclassexpressiontopic.asp
    >
    > I am attempting to use the line.
    > DataColumn.Expresson = "Child.AdminName";
    >
    > I get the error "Cannot interpret token 'Child' at position 1".
    >
    > The DataRelation does exist.
    >
    > Has anyone done this successfully before?
    >
    > Thanks,
    >
    > lee franke
    >
    >
    Prasad, Oct 14, 2003
    #2
    1. Advertising

  3. Lee Franke

    Lee Franke Guest

    Here ya go

    Code that sets up the relationship
    DataColumn parentCol;

    DataColumn childCol;

    parentCol = dsResults.Tables["People"].Columns["adminID"];

    childCol = dsResults.Tables["Admins"].Columns["employeeID"];

    DataRelation myRptRelation = new
    DataRelation("AdminNames",parentCol,childCol,false);

    dsResults.Relations.Add(myRptRelation);



    Code that adds the column
    //now add a NEW column that will populate the admin's name
    DataColumn cName = new DataColumn();

    cName.DataType = System.Type.GetType("System.String");

    cName.ColumnName = "adminName";

    cName.Expression = "Child.displayName" ;

    dsResults.Tables["People"].Columns.Add(cName);

    Thanks,

    lee franke


    "Prasad" <> wrote in message
    news:%23jGj%...
    > Hi
    >
    > Please post your code so that it will be easy to fix.
    >
    > Prasad
    >
    > "Lee Franke" <> wrote in message
    > news:...
    > > I'm trying to implement Child.ColumnName as in this example.
    > >
    > >

    >

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
    > frlrfsystemdatadatacolumnclassexpressiontopic.asp
    > >
    > > I am attempting to use the line.
    > > DataColumn.Expresson = "Child.AdminName";
    > >
    > > I get the error "Cannot interpret token 'Child' at position 1".
    > >
    > > The DataRelation does exist.
    > >
    > > Has anyone done this successfully before?
    > >
    > > Thanks,
    > >
    > > lee franke
    > >
    > >

    >
    >
    Lee Franke, Oct 14, 2003
    #3
    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. =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?=

    UserControl in Template DataColumn

    =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?=, Feb 26, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    458
    Martin Dechev
    Feb 26, 2004
  2. Replies:
    0
    Views:
    599
  3. SMH
    Replies:
    0
    Views:
    822
  4. pbd22
    Replies:
    0
    Views:
    309
    pbd22
    Nov 11, 2007
  5. gg

    datacolumn.expression - Minimum, maximum and average

    gg, Jan 6, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    280
    Mike McIntyre
    Jan 10, 2004
Loading...

Share This Page