At the beginning, I tried panel and found it annoying to add a div automatically ..
The main principle of repeater is to put a repeater on the page, create a table manually, create a record, bind the repeater to the data, and then render the HTML, then you can program the repeater and hide it ..
Below we put the code up, the Code is not advanced, the key lies in the idea ~~ I used to do this in loadhtml. Yesterday I thought it would be more convenient to put it on the ASPX page ..
The following code is attached:
Front-end code
<% = Setpanel. outstr (this. Panel1) %>
<Asp: Panel id = "Panel1" runat = "server">
Fkjfds
</ASP: Panel>
<% = Settemplate. outstr (this. repeater1) %>
<Asp: repeater id = "repeater1" runat = "server">
<Itemtemplate> jjj </itemtemplate>
</ASP: repeater>
Class Code
Public class setpanel
{
Public setpanel ()
{
//
// Todo: add the constructor logic here
//
}
Public static string outstr (Panel PL)
{
System. Io. stringwriter Sw = new system. Io. stringwriter ();
Htmltextwriter HTW = new htmltextwriter (SW );
Pl. rendercontrol (HTW );
Pl. Visible = false;
Return Sw. tostring () + "pengpengmodi ";
}
}
Public class settemplate
{
Public settemplate ()
{
//
// Todo: add the constructor logic here
//
}
Public static string outstr (repeater REP)
{
System. Io. stringwriter Sw = new system. Io. stringwriter ();
Htmltextwriter HTW = new htmltextwriter (SW );
// Create a database dt
System. Data. datatable dt = new datatable ("dttest ");
DT. Columns. Add ("ID", typeof (string ));
DT. Rows. Add (new object [] {"test "});
Rep. datasource = DT;
Rep. databind ();
Rep. rendercontrol (HTW );
Rep. Visible = false;
Return "peng1" + Sw. tostring () + "Modi ";
}
}