Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

Creating and loading Drop Down list using C# in Visual Studio 2005

Author: Zunnair

In this article I will show you the way in which we can create and load asp.Net Dropdown List. This is the most simple way to do that

We can Create by Dragging the control from toolbox and place it to our inner Html in case of in .aspx

And the other way just write the following lines in HTML

<asp:DropDownList ID="ddlTest" runat="server">asp:DropDownList>


So now we created the Drop Down List in page Now we will move further to Loading of Asp.Net Drop down Control. We can use many ways to Load the Drop Down Control

1-      By Our Customized Functions

2-      By using simple C# code

I will explain the way in which we can Create Load method By C# Code which is Easily Understandable for all of you.

Following Code will Use to Load the method

 private void LoadDDl(int ParamID)





           if (ParamID != 0)


              DS.tblDataTable oTbl = new LoadDdl(ParamID, false);

              foreach (DS.tblRow Row in oTbl.Rows)


                   ddlTest.Items.Add(new ListItem(Row.ColName.ToString(), Row.ColID.ToString()));




       catch (Exception oEx)





I Hope this article is usefull for you . You can Use that technique for loading many other Controls.

Article Comments
Actually i want download C# and Visual Studio 2005 Software can anyone please help me in downloading these two software can you please tell me that how can i download these two software in my computer.

Posted on 2/15/2009 4:28:55 AM by malti

Add Article Comment:
Name :
Email Address :
Comments :
<< Comparing Date Colmumns using PLSQL in Sql Server 2005

Disclaimer - Privacy
© 2002-2017