This is a migrated thread and some comments may be shown as answers.

How Add Images to CheckBox

6 Answers 530 Views
CheckBox
This is a migrated thread and some comments may be shown as answers.
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
JeffSM asked on 28 Jun 2018, 01:06 PM
We see an space in check box that could have an 16x16 icon.

6 Answers, 1 is accepted

Sort by
0
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 28 Jun 2018, 01:09 PM

I just open the ticket to show my solution.

Whould be great if it had a property ImgUrl, but, here is my code.

 

<style type="text/css">
    .picCheckBox { display:block; }
    .picOfCheckBox { position: fixed; margin-top: -26px; margin-left: 18px;}
</style>

 <div style="display: block; width: 100%;">
  <telerik:RadCheckBox Checked="false" CssClass="picCheckBox" ID="chk1" runat="server" Text="Some text" />
                                    <img class="picOfCheckBox" title="opo" src="16.png" alt="opnc" width="16" height="16" />
                                  </div>
                                    <div class="clear"></div>

0
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 28 Jun 2018, 01:11 PM
This is the result.
0
Marin Bratanov
Telerik team
answered on 02 Jul 2018, 04:09 PM
Hi Jeff,

The most likely reason for this is that there is another Telerik button on the page with a different RenderMode: https://docs.telerik.com/devtools/aspnet-ajax/controls/checkbox/troubleshooting/distorted-appearance.

Also, if you want to have a custom image in a checkbox, I suggest you consider a ToggleButton instead: https://docs.telerik.com/devtools/aspnet-ajax/controls/togglebutton/overview.
 In case the built-in icons do not suffice for you (https://docs.telerik.com/devtools/aspnet-ajax/controls/togglebutton/functionality/Icons/embedded-icons), its toggle states expose an Image tag where you can provide a URL: https://docs.telerik.com/devtools/aspnet-ajax/controls/togglebutton/functionality/image.


Regards,
Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 03 Jul 2018, 01:36 PM

Both solutions that you say are impossible to be made at this point of the development.

Thanks.

0
Marin Bratanov
Telerik team
answered on 04 Jul 2018, 04:24 PM
Hi Jeff,

You can also use CSS to insert the image in the text span of the checkbox with fewer overrides:

<style type="text/css">
    .picCheckBox .rbText {
      background: url('16.png') no-repeat no-repeat;
      padding-left: 20px;
    }
</style>
 
<telerik:RadCheckBox Checked="false" CssClass="picCheckBox" ID="chk1" runat="server" Text="Some text" />


Regards,
Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 09 Jul 2018, 07:57 PM

Hi Marin:

Works, but with some change:

 

.ChkTYPE16 .rbText { background-image: url('16.png') !important; background-repeat: no-repeat; }
Tags
CheckBox
Asked by
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
Marin Bratanov
Telerik team
Share this question
or