The ObjectDataSource control in Asp. Net transmits the data bound to the parameter,
Recently, I am working as an intern. In the task of top-end delivery, I need to use Asp. net ListView control, so it is necessary to use the ObjectDataSource control, because in the Process of use, the parameters in the web page need to be sent to the background, run this parameter to query data. This process will inevitably involve transmitting parameters to the ObjectDataSource control, and then binding the data after the query. Let's take a look at how this process is implemented:
1. Create a WebForm page and drag the ListView control and ObjectDataSource control.
2. Configure the ObjectDataSource as follows:
2.1 select the business object as the class for obtaining data.
2.2 Select the Select function. Next Step
2.3 click Finish
3. Switch to the design view. In the design view, configure the data source of ListView as the newly addedObjectDataSource object
4. Set the parameters of the SelectMethod function of ObjectSource and execute the SelectMethod function.
int id = 35;ObjectDataSource1.SelectParameters["ID"].DefaultValue = id.ToString();ObjectDataSource1.Select();ObjectDataSource1.DataBind();
5. The final result is as follows:
The above is a summary of your use of the objectSource control, the level is limited, please give me a lot of advice.