protected void btnDropDownMenuItem_Click(object o, EventArgs e) { var tmi = o as TypeMenuItem; if (tmi != null) CreateAndAddInstance(tmi.Type as Type); }