Russ Clark
Russ Clark

Reputation: 13440

How to pass a property from an ASP.Net page to a user control

I have created a user control which exposes a custom type property called SoftwareItem. The page where I have placed this user control has a page property of the same type. I cannot figure out how to pass the page's property to the user control. I understand that this can be done in the code_behind but wanted to set the property declaratively to avoid view state issues with setting this property in the code behind.

Upvotes: 1

Views: 589

Answers (1)

David
David

Reputation: 73554

In the code behind for the user control, do you have the property defined as the custom type?

As in:

public MyCustomType SoftwareItem {get; set;}

Upvotes: 2

Related Questions