ASP.Net RadioButtonList With Images

To add image in RadioButtonList (Static) control

	<asp:RadioButtonList ID="rblEmployee" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" Width="512px">
        <asp:ListItem Value="Kevin"><span style="vertical-align:40px;">Kevin</span>  &lt;img width=100px src=images/Kevin.jpg&gt;</asp:ListItem>
        <asp:ListItem Value="Corne"><span style="vertical-align:40px;">Corne</span>  &lt;img width=100px src=images/Corne.jpg&gt;</asp:ListItem>
        <asp:ListItem Value="Paul"><span style="vertical-align:40px;">Paul</span>  &lt;img width=100px src=images/Paul.jpg&gt;</asp:ListItem>

Use below script to align Image and Radiobutton Alignment

<style type="text/css">
    .ListControl input[type=checkbox], input[type=radio]
        display: none3;
        Vertical-align: 40px;

Required Filed Validation for RadioButtonList

  <asp:RequiredFieldValidator ID="rfvEmployee" runat="server" ControlToValidate="rblEmployee" ErrorMessage="Please Select Employee"></asp:RequiredFieldValidator>

Submit Button Event to get RadioButtonList Selected Text

  protected void btnSubmit_Click(object sender, EventArgs e)
        lblMessage.Text = "Selected Employee ::: " + rblEmployee.SelectedItem.Value;       





Get Selected Value from Code:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s