The first is to add a BulletedList control to the Web page to add the displayed data by editing the item.
This is one way to add data, and the other is to implement it by binding the data source. Before doing this, add a SQL Server database first:
Click to open the right-click menu to modify the connection
Create a table, note that for the character column, it is best to select the nvarchar type, which avoids garbled characters when inputting Chinese data.
Add some data to add some data
Add a data source to the BulletedList control.
Tick the checkbox so that you can see the connection string in the configuration file.
To continue, select the columns to display in the following steps
When you click Done, the SqlDataSource is automatically added in the page design code.
Finally run the Web site, you can see in two ways the control bulletedlist settings of the data are displayed, but why the second bulletedlist only show the contents of a field, not the corresponding URL is displayed.
This is because the DataTextField property in the control bulletedlist specifies the field that is displayed, and the DataValueField property specifies the hidden value.
Although the data is displayed, it does not appear to be clickable URLs as expected. In fact, this is very simple, just need to set a property to
, the DisplayMode property also has LinkButton and text two values, which can be handled in its Click event when the DisplayMode property is LinkButton.
ASP. NET BulletedList bind data and vs2013 Add database file