How to Add Item in ListBox Control Programmatically in vs2010

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.ToolBox-> Double Click on ListBox(or drag and drop ListBox on Design view)-> Right click ListBox->Select Properties-> Click Events(Horizontal arrow on image)-> double click on Init Event
(Vertical arrow on image) to get the code behind
ListBox Control Event
 3.Write this code to your code Behind

 4.click F5 to Run your project->Ok
Programmatical ListBox Control output

No comments:

Post a Comment