Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the methods of data binding for DropDownList drop-down box list controls in ASP.NET

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you the "ASP.NET DropDownList drop-down box list control what are the methods to bind data", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn about "ASP.NET DropDownList drop-down box list control in the way to bind data" this article.

The DropDownList Web server control enables the user to select an item from a predefined list. It differs from the ListBox Web server control in that its item list is hidden until the user clicks the drop-down button. In addition, the DropDownList control differs from the ListBox control in that it does not support multiple selection mode.

The rendering of DropDownList in html corresponds to select, so let's take a look at several ways in which DropDownList binds data.

First, bind the Array array to DropDownList

String [] Month = new string [7] {"January", "February", "March", "April", "May", "June", "July"}; this.DropDownList1.DataSource = Month;this.DropDownList1.DataBind ()

This method can bind only one set of data to DropDownList, because DropDownList can bind two kinds of data: 1 is DataTextField and 2 is DataValueField, so the value of DataTextField after the first method is bound = = DataTextField value.

Bind the dynamic Array array to DropDownList

ArrayList ar = new ArrayList (); for (int I = 1; I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report