Question: I want to set image.imageurl dinamically... But the code bellow just works when the page is not on a masterpage.

Here is the code:

```
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
    Byte[] bytes = AsyncFileUpload1.FileBytes;
    string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);

    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "img",
        "top.document.getElementById('Image1').src='data:image/jpg;base64," + base64String + "';",
        true);
}

```

Answer: 
In the `MasterPage` the `Id` is derived from the `ContentPlaceHolder`, e.g.:

```
ctl00$ContentPlaceHolder1$Image1

```

But why don't you simply use `Image1.ClientId` instead?

```
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "img",
    "top.document.getElementById('" + Image1.ClientId + "').src='data:image/jpg;base64," + base64String + "';",
    true);

```
Tim Schmelter is correct, you could also set the ClientIDMode on the control to Static. E.g.

```
<asp:Image runat="server" ID="Image1" ClientIDMode="Static" />

```

MSDN Docs: <http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode.aspx>