Datalist, repeater nested (nested)

Source: Internet
Author: User

There will be a lotArticleThis article describes the nested datalist repeater, repeater nested repeater, and datalist nested datalist. In summary, there are several methods. If you are interested, you can add them if you have any problems.

1. Microsoft's method is to use a dataset to separately fill the data to the two tables of the dataset, and then set the relationship.

Dataset DS = New Dataset ();
String Sql1 = " Select * From Province " ;
Sqldataadapter sda1 = New Sqldataadapter (sql1, constring );
Sda1.fill (DS, " Province " );

String Sql2 = " Select * from City " ;
Sqldataadapter sda2 = New Sqldataadapter (sql2, constring );
Sda2.fill (DS, " City " );

DS. relations. Add ( " Myrelation " , DS. Tables [ " Province " ]. Columns [ " Provinceid " ], DS. Tables [ " City " ]. Columns [ " Father " ]);
Dlcategories. datasource = DS. Tables [ " Province " ]. Defaultview;
Dlcategories. databind ();

The specific method can take a look at Microsoft's knowledge base or refer to this article http://www.cnblogs.com/singlepine/archive/2006/04/03/365964.html

2. execute in the control event (itemdatabound event). Each time when the data is bound, you can use datarowview to retrieve the data of each row, and then help set the data to the embedded control.

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.