How To Display data in marquee from database by using c#

An HTML marquee is a scrolling piece of text that, depending on the settings, appears horizontally across or vertically down your webpage. This is accomplished through the use of the HTML marquees> tag.

Note − The tag deprecated in HTML5. Do not use this element, instead you can use JavaScript and CSS to create such effects.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Marquee.aspx.cs" Inherits="Marquee" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
   <title>Untitled Page</title>
   <form id="form1" runat="server">
           <marquee id="ml" style="text-align: center" direction="up" width="195" height="170"
               scrolldelay="20" scrollamount="1">
               <asp:Repeater ID="Repeater1" runat="server">
                       <br />
                       <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("URL") %>'>
                           <asp:Label ID="Label1" runat="server" Text='<%# Eval("Desc") %>'></asp:Label></asp:HyperLink><br />
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

public partial class Marquee : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            Repeater1.DataSource = GetData();

    public DataSet GetData()
        DataSet ds = new DataSet();
        DataTable dt = new DataTable("News");
        DataRow dr;
        dt.Columns.Add(new DataColumn("Id", typeof(Int32)));
        dt.Columns.Add(new DataColumn("Url", typeof(string)));

        dt.Columns.Add(new DataColumn("Desc", typeof(string)));
        for (int i = 1; i <= 10; i++)
            dr = dt.NewRow();
            dr[0] = i;
            dr[1] = "URL" + i.ToString();

            dr[2] = "Description " + i.ToString();
        Session["dt"] = dt;
        return ds;
Next Post Previous Post
No Comment
Add Comment
comment url