Controls | data | Show INTRODUCTION
This article describes how to use nested Repeater controls to display hierarchical data. Of course, you can also apply this technique to other list-bound controls, such as a DataGrid containing a combination of datagrid,datalist including DataList, and so on.
Bind to Parent table
1. Add a new Web Form to the application project with the name NestedRepeater.aspx.
2. Repeater
Introduction
In the previous chapter we learned how to display master/slave information in a single page. Another pattern that is often used is to display the master-slave information separately in two pages. master/slave reports in front of the cross page We use this pattern by displaying all the supplier in the GridView. The GridView contains a HyperLinkField, links to another page, and pass the SupplierID through QueryString. The second page uses the GridView to list the product provided by
The Repeater control is a lightweight control but has uses and has become a favorite of mine. developers developers do not realize that you can use templates with the repeater. it has a limited set of templates, with few properties, but you can make use of them as this article demonstrates.
By: John kilgo Date: Jun e 14,200 3 download the code.
Printer friendly version
The
This section describes how to use the Repeater control to display master-slave relational data tables.
See: http://support.microsoft.com/default.aspx? SCID = KB; en-US; 306154
Nestedrepeater. aspx
@ Import namespace="System. Data"
%>
@ Page Language = " C # " Codebehind = " Nestedrepeater. aspx. CS " Autoeventwireup = " False " Inherits = " Emeng. nestedrepeater "
%>
Html
>
Body
>
This section describes how to use the Repeater control to display master-slave relational data tables.
See: http://support.microsoft.com/default.aspx? SCID = KB; en-US; 306154
Nestedrepeater. aspx
@ Import namespace="System. Data"
%>
@ Page Language = " C # " Codebehind = " Nestedrepeater. aspx. CS " Autoeventwireup = " False " Inherits = " Emeng. nestedrepeater "
%>
Html
>
Body
>
Repeater is the simplest and cheapest interconnect device used to extend the network distance in the LAN environment, operates on the physical layer of OSI, and the repeater has the function of amplifying and regenerating the signal on the line.
The Repeater (RP repeater) is a device connecting the network line, which
The way to do this is to write a control yourself that inherits the GridView or repeater and implements the IPageableItemContainer interface. The following to be sent by a foreign expert to write the code, the test is effective. When used specifically, to build a class library project, the code compiled into a DLL, you can add to the VS Toolbox!
First, custom repeater
The code is as follows
The way to do this is to write a control yourself that inherits the GridView or repeater and implements the IPageableItemContainer interface. The following to be sent by a foreign expert to write the code, the test is effective. When used specifically, to build a class library project, the code compiled into a DLL, you can add to the VS Toolbox!
First, custom repeater
Copy Code code as follows:
web| Control
Adding Repeater Web server controls to a page requires several steps. The following procedure describes the minimum steps that a Repeater control must perform to create a work.
Add a Repeater Web server control to a Web Forms page
Adds a data source to a Web forms page. There are several ways to work with data on a page. To select the appropriate m
Download the sample code:/201109/yuanma/JQueryElementTest.rar
The content in this article is as follows:
* Preparation
* Main Functions
* Bind Fields
* Bind attributes
* Basic settings
* Set pagination
* Set Fields
* Set the called server Method
* Request/return data format
* Fill/search
* Update
* Delete
* New
* Line status description
* Sorting status description
* Set a template
* ItemTemplate
* UpdatedItemTemplate/InsertedItemTemplate
* RemovedItemTemplate
* EditItemTemplate
* FilterTemplate
Introduction
In the previous tutorial we learned that DataList provides some style-style attributes. And we've also learned how to define Headstyle, ItemStyle, AlternatingItemStyle, The default CSS for attributes such as SelectedItemStyle. In addition to these four properties, DataList also provides other properties, such as font, ForeColor, BackColor, and borderwidth. And repeater does not provide any such attributes. If you need to use Reperter to
Using system; using system. data; using system. configuration; using system. web; using system. web. security; using system. web. ui; using system. web. UI. webcontrols; using system. web. UI. webcontrols. webparts; using system. web. UI. htmlcontrols; using system. data. sqlclient; public partial class _ default: system. web. UI. page {sqlconnection conn = new sqlconnection ("Server = .; database = Master; uid = sa; Pwd = sa "); protected Vo Id page_load (Object sender, eventargs e) {If (! Ispo
. Aspx page code
Copy codeThe Code is as follows: . Aspx. cs post code Copy codeThe Code is as follows: public partial class Temp: System. Web. UI. Page{Dictionary Protected void Page_Load (object sender, EventArgs e){Dict. Add (1, new List {New User {Id = 1, Name = "aa "}, New User {Id = 2, Name = "bb "}});Dict. Add (2, new List {New User {Id = 3, Name = "cc "}, New User {Id = 4, Name = "dd "}});Repeater1.DataSource = dict;Repeater1.DataBind ();}}Pu
. aspx page code
Copy Code code as follows:
. Aspx.cs Post Code
Copy Code code as follows:
public partial class Temp:System.Web.UI.Page
{
Dictionaryprotected void Page_Load (object sender, EventArgs e)
{
Dict. ADD (1, New list{
New User{id = 1, Name = "AA"}
, New User{id = 2, Name = "BB"}
});
Dict. ADD (2, New list{
New User{id = 3, Name = "CC"}
, New User{id = 4, Name = "dd"}
});
Repeat
Repeater, like the GridView data list, are used to display the information of the database, where repeater is the most basic form of the list, and its usage is more flexible. First, the location of repeater: Toolbox-Data-repeater Drag and drop the display after entering the page: Switching to Source view will reveal
The object hierarchy chart shows that repeater is the lightest and smallest control.It only inherits the functions of basic controls, including the ID attribute and subcontrol set. Datalist and DataGrid inherit the webcontrol function, including style and appearance attributes.From the perspective of object model, repeater is the simplest control and the smallest data binding control,It has no appearance, n
How to display hierarchical data by using nested repeater controls and Visual C #. netview products that this Article applies.
Article ID
:
306154
Last Review
:
July 15,200 4
Revision
:
4.1
This article was previusly published under q306154on this page
Summary
Bind to the parent table
Bind to the child table
Complete code list
Nestedrepeater. aspx
Nested
I saw an old post on csdn a few days ago, discussing what controls are better for Data Binding applications in. net. In the community, I also saw a friend asking whether these controls should be used. Let me talk about my thoughts. Hope to help new users.
Let's take a look at the main differences between several data-bound controls:
The repeater, datalist, and gridview controls are based on the same programming model. At the same time, each control is
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.