myBlock.AddButton(strCustomButton);
I made sure that this was the case by controlling the context myself.
The code behind the button looks like:
var strSID = new String(Request.QueryString("SID"));
var intDominateKey = 2; //person is the new target context
var intKey1 = 28; //unique id of target company
var intKey2 = 30; //unique id of target person
var strFileName = "testjump.asp"; //target file
var strTabName = "Person"; //tabgroup name to be used.
var strTarget = "http://localhost/CRMdemo/CustomPages/testjump.asp?SID="+strSID+" &Key0="+intDominateKey+" &Key1="+intKey1+" &Key2="+intKey2+" &J="+strFileName+" &T="+strTabName;
var strPersonButton = CRM.Button("Person","findperson.gif",strTarget);
myBlock.AddButton(strPersonButton);
I hardcoded some of the values above. In the real world the values would be derived from the existing context. Hopefully the comments make it clear what needs to be changed. The most important part is the change in the dominate key (Key0).
Other useful articles: