To add master Page dynamically you should use Page_PreInit event of content page. So at Page_PreInit you have to access Master Page name since this Page_PreInit event occurs before Load event you can use Request.QueryString, cookies etc to access the name of Master Page.
Like in following example I use Request.QueryString to access the name of Master Page.
Since you can have more than 1 Master page, add name of all Master Page to a DropDownList
Use following at default.aspx at any event.
But before these you have to create Master Pages named those properly.
Default2 page should look like follow
void Page_PreInit(object sender,EventArgs e)
string str= (string)Request.QueryString["val"];
this.MasterPageFile = str;