Saturday, 24 October 2015

Bind Arraylist with DropdDownList in Asp.Net C#

Bind Arraylist with DropdDownList 

Dropdownlist Bind From The Arraylist Items Values Using in Asp.Net C#.

                                   DEMO


                              Download

                           HTML Coding

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        <asp:DropDownList ID="ddlCourse" runat="server"></asp:DropDownList>
    </div>
    </form>
</body>
</html>



                           C# Coding

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 _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ArrayList Course = new ArrayList();
            Course.Add("ASP.NET");
            Course.Add("C#.NET");
            Course.Add("DropDownList");
            Course.Add("GridView");
            Course.Add("SQL Server");          
            ddlCourse.DataSource = Course;
            ddlCourse.DataBind();
        }
    }

}









0 comments:

Post a Comment