| |

VerySource

 Forgot password?
 Register
Search
View: 658|Reply: 3

Entity class as a property of another entity class, how to bind the properties of this entity class in the DataList cont

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-30 09:20:01
| Show all posts |Read mode
E.g:
class A {
    private int property1;
    public int Property1 {
        get {return property1;}
    }
    private B property2;
    public B Property2 {
        get {return property2;}
    }
}

class B {
    private int property1;
    public int Property1 {
        get {return property1;}
    }
}

aspx page:
List <A> list = ...
datalist.DataSource = list

problem:
How can I bond to A.B.Property1
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-7 09:15:01
| Show all posts
Eval ("B.Property")
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-7 11:15:01
| Show all posts
B's name is replaced with the attribute name you created in A!
Reply

Use magic Report

0

Threads

26

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-3-7 20:30:02
| Show all posts
DataBinder.Eval (Container, "DataItem.Property2.Property1")
Isn't it OK?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list