ASPxClientImage.SetImageUrl(url) Method
Sets the URL which points to the image displayed within the image editor.
Declaration
SetImageUrl(
url: string
): void
Parameters
Name | Type | Description |
---|---|---|
url | string | A string value specifying the URL to the image displayed within the editor. |
Remarks
Use the SetImageUrl method to specify the URL to the image displayed within the ASPxClientImage.
All graphic file formats which can be interpreted by internet browsers are supported. The image’s URL can represent either an absolute or relative path.
Example
This code example demonstrates how to use the client ASPxClientImage.SetImageUrl
method to dynamically switch images on the client, based on the length of text entered in a text box.
<script type="text/javascript">
function OnKeyUp(s, e) {
var text = s.GetText();
if (text.length > 0)
imgSearch.SetImageUrl('Images/search2.png');
else
imgSearch.SetImageUrl('Images/search1.png');
}
</script>
<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" Width="170px">
<ClientSideEvents KeyUp="OnKeyUp" />
</dx:ASPxTextBox>
<dx:ASPxImage ID="ASPxImage1" runat="server" ClientInstanceName="imgSearch" ImageUrl="~/Images/search1.png">
</dx:ASPxImage>
See Also