Reputation: 10805
how to load the same user control with different different condition in the same page for different different view.
i want to load a user control in the asp page in the 5 different different DIV, they have got a common view but different code behind that i can manage with the case statement at page load, i want to know how to make DIV know that for the same user control placed in the DIV what case to execute.
Upvotes: 0
Views: 220
Reputation: 19953
Create a property in the usercontrol, which can be set either via the markup, or via the code in the codebehind.
For example...
private _myVar int = 0;
public int MyVar
{
set { _myVar = value; }
}
Then you can set in the markup like...
<uc1:MyCtrl runat="sever" ID="ctrl1" MyVal="1"/>
Or in the codebhind you can...
ctrl.MyVar = 1;
Upvotes: 2