Adam Lassek
Adam Lassek

Reputation: 35515

How do I access a public property of a User Control from codebehind?

I have a user control in a repeater that I need to pass data to during the databound event, so I've created two public properties in the control. How do I access these properties from the page's codebehind class?

Upvotes: 0

Views: 647

Answers (1)

FlySwat
FlySwat

Reputation: 175733

During the databind event in the repeater?

MyUserControl myControl = (MyUserControl)e.item.FindControl("NameInASPX");
myControl.MyCustomProperty = foo;

Upvotes: 4

Related Questions