Click here to Skip to main content
Licence CPOL
First Posted 15 Mar 2008
Views 18,100
Downloads 292
Bookmarked 17 times

Updatable News Marquee

Up-To-Date News Marquee Without Postback
4 votes, 66.7%
1
1 vote, 16.7%
2
1 vote, 16.7%
3

4

5
1.31/5 - 6 votes
μ 1.31, σa 1.46 [?]

Introduction

A lot of Portals and News Websites add "News Marquee" which shows latest News when visitor request the page, So we need to show up-to-date news without refresh the page, we can do this with using AJAX Timer, UpdatePanel and Html Marquee < > tag.

Background

Html Marquee catch last news when visitor refresh the page. We would like to follow latest News without any postback.

Using the code

            

    //Add More News to the Marquee
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        DataTable dt_NewsNews;
        if (ViewState["GetNews"] != null)
        {
            dt_NewsNews = (DataTable)ViewState["GetNews"];
        }
        else
        {
            dt_NewsNews = NewsTable();
        }

        DataRow dr = dt_NewsNews.NewRow();
        dr["ItemID"] = dt_NewsNews.Rows.Count + 1;
        dr["Title"] = "BBC" + dt_NewsNews.Rows.Count;
        dt_NewsNews.Rows.Add(dr);
        ViewState["GetNews"] = dt_NewsNews;
    }

    //Create Data Source (DisConnected Method: DataTable)
    public DataTable NewsTable()
    {
        DataTable dt_GetNews = new DataTable();
        DataColumn dc;
        dc = new DataColumn("ItemID", System.Type.GetType("System.String"));
        dt_GetNews.Columns.Add(dc);
        dc = new DataColumn("Title", System.Type.GetType("System.String"));
        dt_GetNews.Columns.Add(dc);

        DataRow dr = dt_GetNews.NewRow();
        dr["ItemID"] = "1";
        dr["Title"] = "BBC";
        dt_GetNews.Rows.Add(dr);
        ViewState["GetNews"] = dt_GetNews;

        return ((DataTable)ViewState["GetNews"]);
    }


License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Khaled Mohamed Rawy

Web Developer

Egypt Egypt

Member
Khaled Mohamed Rawy
ASP.Net Developer
Egypt Cairo
khaledrawy@hotmail.com
khm@alawael-it.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
General[My vote of 2] ur script not working properly Pinmembershahab ali rizvi2:23 18 Jun '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120209.1 | Last Updated 15 Mar 2008
Article Copyright 2008 by Khaled Mohamed Rawy
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid