Question: I'm using a short bit of C# code to create an `iFrame` with a pdf inside of it.

However, the iFrame comes up empty. 

```
 LiteralControl c= new  LiteralControl("<iframe id='embeddedFrame' name='embeddedFrame' runat=server src="+filePath+" width=400 height=400></iframe>");
 ph.Controls.Add(c);

```

Viewing the page source gives me this:

```
<iframe id="embeddedFrame" name="embeddedFrame" runat="server" src="C:\Users\Houseman\Desktop\WebApplication1\WebApplication1\Data\Untitled1.pdf" width="400" height="400"></iframe>

```

Which looks correct. I do indeed have that .pdf file in that location. There's no 404 error, it's just blank... 

What am I doing wrong, or how could I fix this?

---

I can access the file through my browser, except that I have to take out `localhost:8683` and replace it with `file:///`

---

I'm accessing the file with 

```
string PdfLocation = System.IO.Path.Combine(Server.MapPath("Data") ,pdfn);

```

Where `pdfn` is the filename of the upload +".pdf"

Answer: 
The FocusManager solution didn't work for me for some reason. Also I required a more general apporach. So here is, what I came up with:

```
using System.Windows.Controls;

public static void RestoreFocus(this DataGrid dataGrid,
                                     int column = 0, bool scrollIntoView = false)
{
    if (dataGrid.IsKeyboardFocusWithin && dataGrid.SelectedItem != null)
    {
        // make sure everything is up to date
        dataGrid.UpdateLayout();

        if (scrollIntoView)
        {
            dataGrid.ScrollIntoView(dataGrid.SelectedItem);
        }

        var cellcontent = dataGrid.Columns[column].GetCellContent(dataGrid.SelectedItem);
        var cell = cellcontent?.Parent as DataGridCell;
        if (cell != null)
        {
            cell.Focus();
        }
    }
}

```

And call it like this:

```
MyDataGrid.IsKeyboardFocusWithinChanged += (sender, e) =>
{
    if ((bool)e.NewValue == true)
    {
        Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, new Action(() =>
        {
            MyDataGrid.RestoreFocus(scrollIntoView: true);
        }));
    }
};

```
This PowerShell snippet worked for me:

```
$dataGrid = ...    
$dataGrid.add_GotKeyboardFocus({
    param($Sender,$EventArgs)
    if ($EventArgs.OldFocus -isnot [System.Windows.Controls.DataGridCell) {
        $row = $dataGrid.ItemContainerGenerator.ContainerFromIndex($dataGrid.SelectedIndex)
        $row.MoveFocus((New-Object System.Windows.Input.TraversalRequest("Next")))
    }
})

```