OK, been a while but I'm really stumped on this one. I want to change the image source of an ASPxButton from the code behind (later I will add conditions). The ImageUrl property updates but the height, width and borderstyle are lost (image appears at it's own height & width with a thick black border).
<dx:GridViewDataTextColumn FieldName="SyncStatus" VisibleIndex="0" Caption=" " Width="22px">
<DataItemTemplate>
<dx:ASPxButton runat="server" Image-Url="~/Images/Wizard/Wand24x24.png" Height="20px" Width="20px"
Border-BorderStyle="None" id="btnWiz" OnInit="btnWiz_Init"></dx:ASPxButton>
</DataItemTemplate>
</dx:GridViewDataTextColumn>
Protected Sub btnWiz_Init(sender As Object, e As EventArgs)
Dim btnWiz As ASPxButton = TryCast(sender, ASPxButton)
Dim container As GridViewDataItemTemplateContainer = TryCast(btnWiz.NamingContainer, GridViewDataItemTemplateContainer)
btnWiz.ImageUrl = "~/Images/NewNote.png"
btnWiz.Border.BorderStyle = BorderStyle.None
btnWiz.Border.BorderWidth = Unit.Pixel(0)
btnWiz.Height = Unit.Pixel(20)
btnWiz.Width = Unit.Pixel(20)
End Sub
I tried adding this as a solution
.dxbButton
{
border-style: none;
height: 20px;
width: 20px;
}
but element inspection shows this is ignored. Please advise as ypu are able and thank you in advance.
Apparently it was a minor syntax adjustment (as I suspected). The proper syntax is
btnWiz.Image.Height = 20
btnWiz.Image.Width = 20
and of course this is fully documented somewhere I'm sure. It also took care of the border issue.