How to use data bindingOnce you’ve configured a data source control, y dịch - How to use data bindingOnce you’ve configured a data source control, y Việt làm thế nào để nói

How to use data bindingOnce you’ve

How to use data binding
Once you’ve configured a data source control, you can bind it to a web form control to automatically display the data retrieved by the data source on the page. In the following topics, you’ll learn how to bind a list control to a data source and how to bind controls defined within the templates of another control like a DataList control.
How to bind a list control to a data source
Figure 13-14 shows how to bind a list control to a data source. To do that, you use the three attributes in the table in this figure. The DataSourcelD attribute provides the ID of the data source. The DataTextField attribute provides the name of the data source field that’s displayed in the list. And the DataValueField attribute provides the name of the data source field that is returned by the SelectedValue property when the user selects an item from the list.
You can set these attributes manually by using the Properties window or by editing the aspx code. Or, you can use the Data Source Configuration Wizard shown at the top of this figure to set these properties. To do that, display the smart tag menu for the list and select Choose Data Source. Then, use the wizard’s controls to set the data source, display field, and value field.
The code example in this figure shows a drop-down list that’s bound to a data source named SqlDataSourcel. The field named LongName provides the values that are displayed in the drop-down list, and the field named CategorylD supplies the value that’s returned by the SelectedValue property when the user selects an item from the list.
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
How to use data binding
Once you’ve configured a data source control, you can bind it to a web form control to automatically display the data retrieved by the data source on the page. In the following topics, you’ll learn how to bind a list control to a data source and how to bind controls defined within the templates of another control like a DataList control.
How to bind a list control to a data source
Figure 13-14 shows how to bind a list control to a data source. To do that, you use the three attributes in the table in this figure. The DataSourcelD attribute provides the ID of the data source. The DataTextField attribute provides the name of the data source field that’s displayed in the list. And the DataValueField attribute provides the name of the data source field that is returned by the SelectedValue property when the user selects an item from the list.
You can set these attributes manually by using the Properties window or by editing the aspx code. Or, you can use the Data Source Configuration Wizard shown at the top of this figure to set these properties. To do that, display the smart tag menu for the list and select Choose Data Source. Then, use the wizard’s controls to set the data source, display field, and value field.
The code example in this figure shows a drop-down list that’s bound to a data source named SqlDataSourcel. The field named LongName provides the values that are displayed in the drop-down list, and the field named CategorylD supplies the value that’s returned by the SelectedValue property when the user selects an item from the list.
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Làm thế nào để sử dụng dữ liệu ràng buộc
khi bạn đã cấu hình một điều khiển nguồn dữ liệu, bạn có thể gắn nó vào một điều khiển biểu mẫu web để tự động hiển thị các dữ liệu lấy ra từ nguồn dữ liệu trên trang. Trong các chủ đề sau đây, bạn sẽ tìm hiểu làm thế nào để ràng buộc một danh sách kiểm soát với một nguồn dữ liệu và làm thế nào để ràng buộc các điều khiển xác định trong mẫu của một điều khiển như một điều khiển DataList.
Làm thế nào để ràng buộc một danh sách kiểm soát với một nguồn dữ liệu
hình 13-14 cho thấy làm thế nào để ràng buộc một danh sách kiểm soát với một nguồn dữ liệu. Để làm điều đó, bạn sử dụng ba thuộc tính trong bảng trong hình này. Các thuộc tính DataSourcelD cung cấp các ID của các nguồn dữ liệu. Các thuộc tính DataTextField cung cấp tên của các lĩnh vực nguồn dữ liệu được hiển thị trong danh sách. Và các thuộc tính DataValueField cung cấp tên của các lĩnh vực nguồn dữ liệu được trả về bởi thuộc tính SelectedValue khi người sử dụng chọn một mục từ danh sách.
Bạn có thể thiết lập các thuộc tính này bằng tay bằng cách sử dụng cửa sổ Properties hoặc bằng cách chỉnh sửa mã aspx. Hoặc, bạn có thể sử dụng Data Source Configuration Wizard hiển thị ở đầu của con số này để thiết lập các thuộc tính. Để làm điều đó, hiển thị menu thẻ thông minh cho danh sách và chọn Choose Data Source. Sau đó, sử dụng các điều khiển của wizard để thiết lập nguồn dữ liệu, lĩnh vực hiển thị, và lĩnh vực giá trị.
Đoạn mã ví dụ trong hình này cho thấy một danh sách thả xuống đó ràng buộc với một nguồn dữ liệu có tên SqlDataSourcel. Các trường có tên longname cung cấp các giá trị được hiển thị trong danh sách thả xuống, và các lĩnh vực tên CategorylD cung cấp giá trị đó được trả về bởi các thuộc tính SelectedValue khi người sử dụng chọn một mục từ danh sách.
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2024 I Love Translation. All reserved.

E-mail: