control.setFilterXml(fetchXml);
control.refresh();

function onLoad(executionContext) {
var formContext = executionContext.getFormContext();
var subgrid = formContext.getControl("YOUR_SUBGRID_NAME");
if (subgrid) {
subgrid.addOnLoad(function () {
var Name = formContext.getAttribute("c_name").getValue();
var fetchXml = "<fetch mapping='logical' distinct='true'>" +
"<entity name='c_dp'><attribute name='c_name' />" +
"<link-entity name='c_dt' from='c_relatedtoprogram' to='c_dtpid' link-type='inner'>" +
"<filter><condition attribute='c_name' operator='eq' value='" + Name + "' /></filter>" +
"</link-entity></entity></fetch>";
subgrid.setFilterXml(fetchXml);
subgrid.refresh();
});
}
}
Notes:
setFilterXml() after the subgrid has loaded.addOnLoad.