programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Sunday, August 3, 2014

Example of RadioButtonList control

RadioButtonList Web Server Control: Radio button list control give a permission to user to select an item from given list of controls.Radiobutton support data bind Programming in from database. We can also bind data it manually by input list item inside RBlist control tag. button list is a single selection radio button group.

RBList proparties

Buttonlist have a collection of items. You can determine which item is selected by selectItem property of RadioButton. we can change it's design by setting up it's  properties as like BackColor property, BorderColor property of RadioButton, BorderStyle property, BorderWidth property, CellPadding property, CellSpacing property, CssClass property, Font-Bold property of RadioButtonList, Font-Italic property, Font-Names property, Font-Overline property, Font-Size property etc. 

RBList Class: 

RadioButtonlist control
Radio Button list in .net Programming

RadioButtonList Constructor:

RadioButtonList(), is a contractor of RadioBtton it is use to creating a new Instants. It is public type means every one Access it form any where.


CssClass property, Font-Bold property of RadioButtonList, Font-Italic property, Font-Names property, Font-Overline property, Font-Size property etc.
There are more three properties Repeat Columns, Repeat Direction and Repeat Layout which help you to place list item vertically or horizontally. 

RadioButtonList example in

First create a Web Form name RadioButtonList.aspx. I just use this RadioButtonList to place image list. When you select any option then specific image is shown in Image control. In this example of RadioButtonList use two property are important, first property AutoPostBack and second one  OnSelectedIndexChanged property. Here is the source code.

<%@ Page Language="C#" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> 

<script runat="server"> 
    protected void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e) { 
        Image1.ImageUrl = "Images/" + RadioButtonList1.SelectedItem.Text.ToString(); 

<html xmlns=""> 
<head id="Head1" runat="server"> 
    <title>RadioButtonList example,Use of buttonlist control</title> 
    <form id="form1" runat="server"> 
        <asp:Image ID="Image1" runat="server" Height="100px"
            ImageUrl="~/Images/Flower1.jpg" Width="96px" /> 
        <br /> 
        <asp:Label ID="Label1" runat="server" Text="Select for view image"></asp:Label> 
        <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="2" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged" AutoPostBack="true">  
how to use RadioButtonList  in

RadioButtonList have standard AutoPostBack property. As like other list control radiobuttonlist have an excellent event SelectedIndexChanged. so that when someone select an item it automatically post back the page and we can determine programmatically which item is selected now. for that we need to set AutoPostBack property value to true and setup a SelectedIndexChanged event. DataSourceID, DataTextField and DataValueField property help you to data bind radiobuttonlist with database. radiobuttonlist also support theme and skin.

Example of Use radiobutton list in html:

   <form id="Form1" runat="server">
      <h3>RadioButtonList Example</h3>
      <asp:RadioButtonList id=RadioButtonList1 runat="server">
         <asp:ListItem>Item 1</asp:ListItem>
         <asp:ListItem>Item 2</asp:ListItem>
         <asp:ListItem>Item 3</asp:ListItem>
         <asp:ListItem>Item 4</asp:ListItem>
         <asp:ListItem>Item 5</asp:ListItem>
         <asp:ListItem>Item 6</asp:ListItem>
      <asp:Button id="Button1"
      <asp:Label id="Label1"
</html> Radiobuttonlist
Html Radiobuttonlist

Related Post:

No comments:

Post a Comment