The ObjectDataSource control in Asp. Net transmits the data bound to the parameter,

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.