How does repeater break down the display and layout
This article mainly shows you "repeater how to separate display and layout", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to separate display and layout of repeater" this article.
Front Desk
Backstage
The copy code is as follows:
Public int i = 1
Protected void Page_Load (object sender, EventArgs e)
{
String sqlstr = @ "data source=PC-LENOVE\ SQLEXPRESS;initial catalog=KFC;USER ID=SA;PASSWORD=abing520"
SqlConnection con = new SqlConnection (sqlstr)
SqlCommand cmd = new SqlCommand ()
Cmd.CommandText = "SELECT * FROM Foods"
Cmd.Connection = con
SqlDataAdapter adapter = new SqlDataAdapter (cmd)
DataTable dt = new DataTable ()
Adapter.Fill (dt)
Cmd.Dispose ()
Con.Dispose ()
This.Repeater1.DataSource = dt
This.Repeater1.DataBind ()
}
Protected void Repeater1_ItemDataBound (object sender, RepeaterItemEventArgs e)
{
If (I% 4 = = 0) / / 4 is a row showing the number of columns
{
E.Item.Controls.Add (new LiteralControl ("))
}
ITunes +
}
The above is all the contents of the article "how to display and layout repeater". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!