During the development of Asp.net, many times, first, the search is performed on the webpage, and then the results are operated on other functions again. In the following example, the user clicks the button on the webpage to obtain the relevant data and then updates the data.
The result is a dataset. You can use the gridview, datalist, or repeater Data Control to display these datasets.
Create a logical class fruitcategory, which is used to communicate with data, pass in and output transactions.
Below, insus. net uses the gridview to display:
The following is the implementation of XXX. aspx. CS code, which is super simple:
Demo:
If you do not like the gridview control very much and are used to the Repeater control, you can look at it below. Insus. Net switched the gridview control to the Repeater control to create a webpage:
Default2.aspx. CS is similar to that of the gridview, and the value of the primary key is slightly changed.
Demo:
Let's look at the details and make the first record into an object for processing. Insus. Net creates a user control. However, before the creation, we should think of a problem, that is, we need to pass the data to this user control, so insus. Net has to develop an interface:
This interface has a set (object Value) method, that is, set the value for the user control.
Now you can create the row. ascx:
Complete the row. ascx. CS code:
After the row object is created, search for or load data on the webpage and dynamically Add the user control cyclically:
Xxx. aspx. CS:
OK. This function is demonstrated in Real Time:
Secondary events and detailed functions