cd function. Codebehind switch