"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Friday, February 22, 2013

Scroll text on webpage


Scroll text on webpage

Front end

<table width="100%" cellspacing="0px" cellpadding="0px" class="NewsBgColor">
    <tr>
        <td class="Table_TD_Center">
            <marquee behavior="SCROLL" width="100%" scrolldelay="100″" 
onmouseover='this.stop();' onmouseout='this.start();'>
                <asp:Label ID="lblNews" runat="server" Text="" CssClass="RedLabel">
                </asp:Label>
            </marquee>
        </td>
    </tr>
</table>



Back End


protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Fill News Section
            FillNews();
        }
    }

    private void FillNews()
    {
        // Fetch News Records from Database and Store in Datatable…

        string news = null;

        for (int i = 0; i < DataTable.Rows.Count; i++)
        {
            news = news + DataTable.Rows[i]["News"].ToString();
            news = news + "  ||  ";
        }

        lblNews.Text = news;
    }
}


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

No comments: