📄 supercontentrotator.aspx
字号:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Register TagPrefix="Superexpert" Namespace="Superexpert" Assembly="Superexpert.SuperContentRotator" %>
<script runat="server">
void Page_Load() {
if (!Page.IsPostBack) {
// Load SuperContentRotator from ArrayList
ArrayList colItems = new ArrayList();
colItems.Add( "Apples" );
colItems.Add( "Oranges" );
colItems.Add( "Apricots" );
colItems.Add( "Walnuts" );
ctlRotator1.DataSource = colItems;
ctlRotator1.DataBind();
// Load SuperContentRotator from XML file
ctlRotator2.ContentFile = "Books.xml";
ctlRotator2.DataBind();
// Load SuperContentRotator from database
SqlConnection con = new SqlConnection("server=localhost;Trusted_Connection=true;database=Northwind");
SqlCommand cmd = new SqlCommand("SELECT * FROM Categories", con);
con.Open();
ctlRotator3.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
ctlRotator3.DataBind();
}
}
</script>
<html>
<head>
<title>SuperContentRotator</title>
</head>
<body>
<form runat="server">
<Superexpert:SuperContentRotator
id="ctlRotator1"
RepeatItems="2"
TableStyle-CellPadding="10"
ItemStyle-BackColor="LightGray"
AlternatingItemStyle-BackColor="AliceBlue"
runat="Server">
<ItemTemplate>
<%# DataBinder.Eval(Container, "DataItem") %>
</ItemTemplate>
</Superexpert:SuperContentRotator>
<hr>
<Superexpert:SuperContentRotator
id="ctlRotator2"
RepeatItems="3"
RepeatLayout="Flow"
runat="Server">
<ItemTemplate>
<li> <%# DataBinder.Eval(Container, "DataItem.text") %>
</ItemTemplate>
</Superexpert:SuperContentRotator>
<hr>
<Superexpert:SuperContentRotator
id="ctlRotator3"
RepeatItems="2"
TableStyle-Width="300px"
TableStyle-BorderStyle="Solid"
TableStyle-BorderWidth="1"
TableStyle-BorderColor="Black"
TableStyle-Cellspacing="0"
TableStyle-Cellpadding="10"
runat="Server">
<ItemTemplate>
<b><%# DataBinder.Eval(Container, "DataItem.CategoryName") %></b>
<br />
<%# DataBinder.Eval(Container, "DataItem.Description") %>
</ItemTemplate>
</Superexpert:SuperContentRotator>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -