I'm guessing you have InfoPath 2010 browser running on SharePoint 2010. You should be able to do this - that's what the event was created for. We do this in the rich client all the time but not for master-detail. Doing it for a repeating table is easy and it's relatively straightforward to set up a master/detail that does not use the master/detail control (rather two repeating tables or sections).
I believe Greg Collins has some blog posts and samples that show how to get the current context. Please search around for that. If you can't find anything, please send me email.