C# 如何使用asp.net在中继器中显示x项并滚动或淡出下一项?

C# 如何使用asp.net在中继器中显示x项并滚动或淡出下一项?,c#,jquery,asp.net,repeater,C#,Jquery,Asp.net,Repeater,我有一个在主页上显示“新闻”的转发器,它是从数据库中显示的我希望一次只显示2条记录,并在特定毫秒后自动滚动下两个项目,并具有滚动或淡出淡出效果。 在aspx页面中: <asp:Repeater ID="RepDetails" runat="server" OnItemDataBound="RepDetails_ItemDataBound"> <HeaderTemplate> </HeaderTemplate> &

我有一个在主页上显示“新闻”的转发器,它是从数据库中显示的我希望一次只显示2条记录,并在特定毫秒后自动滚动下两个项目,并具有滚动或淡出淡出效果。

在aspx页面中:

<asp:Repeater ID="RepDetails" runat="server" OnItemDataBound="RepDetails_ItemDataBound">
        <HeaderTemplate>
        </HeaderTemplate>
        <ItemTemplate>
            <div id="MainContent" style="border: 1px;">
                <table>
                    <tr>
                        <td rowspan="2" class="auto-style2">
                            <img src="Images/lasts1.png" />
                        </td>
                        <td>
                            <asp:Label ID="lblNewsTitle" runat="server" Font-Bold="True" /></td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr width="100px">
                        <td>
                            <asp:Label ID="lblNewsDescription" runat="server" /></td>
                        <td>&nbsp;</td>
                    </tr>
                </table>

            </div>
            <hr />
        </ItemTemplate>
        <FooterTemplate>
        </FooterTemplate>
    </asp:Repeater>
谢谢你的帮助!
谢谢

尝试使用某种jquery滑块

既然您标记了jquery,我想您也会接受jquery解决方案:hello@Yeronimo,我想在一段时间后自动滚动,比如说每2秒后,它必须在中继器中显示下两条记录我提到的滚动条可以做到这一点:
protected void RepDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = e.Item.DataItem as DataRowView;

                string Id = Convert.ToString(dr["NewsID"]);
                //HtmlGenericControl teammemberapp = e.Item.FindControl("teammemberapp") as HtmlGenericControl;
                //Link to TeamMemberDetails Page 
                //teammemberapp.Attributes.Add("onclick", "window.location.href='NewsDetails.aspx?Id=" + Id + "'");

                string newsTitle = Convert.ToString(dr["NewsTitle"]);
                Label lblNewsDescription = e.Item.FindControl("lblNewsDescription") as Label;
                Label lblNewsTitle = e.Item.FindControl("lblNewsTitle") as Label;
                //set First Name Label
                lblNewsTitle.Text = newsTitle;

                string newsDescription = Convert.ToString(dr["NewsDescription"]);
                if (newsDescription.Length > 50)
                {
                    lblNewsDescription.Text = newsDescription.Substring(0, 50) + "..";
                }
                else
                {
                    lblNewsDescription.Text = newsDescription;
                }



            }
        }



    public void GetRecord()
            {
                string connectionString = ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString.ToString();
                DataTable datatable = new DataTable();
                using (SqlConnection connection = new SqlConnection(connectionString))
                {

                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = connection;
                    connection.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "usp_NewsSelectYES";
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(datatable);
                    connection.Close();
                }

                //Bind Table to Repeater
                RepDetails.DataSource = datatable;
                RepDetails.DataBind();
            }


    protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    //Get all news with yes
                    GetRecord();

                }
            }