To achieve this scenario, you have to first define public property in aspx page like this.
public DropDownList AffinityGroupDDL { get { return ddlAffinityGroup; } }
After that you can access your page controls like below
var dropDownList = ((StMainDashboard)Page).AffinityGroupDDL;
Try this.