Thursday, July 18, 2013

Bind data to RadioButtonList with arraylist in asp.net

Title:
How to bind data to web server control using array list in asp.net using c#

Description:
Array list can hold list of items of similar data type.When  we want  declare the array list with specific size,no need to set the size of array list,because it can be re sizable automatically .

Example:
The below example will show how to add data statically and dynamically to radio button through array list.But  the binding concepts are also utilize for bind data to this standard control..Later articles i would like give all methods regarding array list

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ArrayList listNum = new ArrayList();
listNum.Add("b");
listNum.Add("h");
listNum.Add("a");
listNum.Add("k");
listNum.Add("r");
rbNumber.DataSource = listNum;
rbNumber.DataBind();
}
}
I hope it is helping for you.Thanks for coming and visit again

No comments:

Bel