Friday, September 10, 2010

Example on filling arraylist to dropdown list

by Narendra, .Net Developer

<html xmlns="" >
<head runat="server">
<title> How to fill dropdownlist using Array list</title>


<form id="form1" runat="server">
<asp:Label ID ="lblexddl" text=" Example on filling arraylist to dropdown list" runat="server" ></asp:Label>
<br />
<asp:DropDownList ID="ddl" runat="server" ForeColor="BlueViolet" Font-Bold="true"
Font-Size="Medium" ></asp:DropDownList>
<br />
<asp:GridView ID="GV" runat="server" ></asp:GridView>

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)
// adding items to arraylist
ArrayList orderarraylist = new ArrayList();
orderarraylist.Add("Product Id");
orderarraylist.Add("Product Name");

//Binding the atrraylist to dropdownlist
ddl.DataSource = orderarraylist;


No comments:

Post a Comment