Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a jquery news slider in my website.
This is the code of slider.
JavaScript
<script>
    function tick2() {
        $('#ticker_02 li:first').slideUp(function () { $(this).appendTo($('#ticker_02')).slideDown(); });
    }
    setInterval(function () { tick2() }, 3000);
</script>

Asp.net code:
ASP.NET
<ul id="ticker_02" class="ticker"   runat="server">

C# Code for loading data from database.
C#
List<refnoticeboard> mgsl = (from r in context.RefNoticeBoards where r.Active == true select r).ToList();

        foreach (RefNoticeBoard i in mgsl)
        {
            HtmlGenericControl newLi = new HtmlGenericControl("li");
            //newLi.InnerText = d.DeptName ;
            HtmlGenericControl anchor = new HtmlGenericControl("a");
            var navlink = i.NavgURL;
            anchor.Attributes.Add("href", navlink);
            anchor.InnerText = i.NoticeDate + " " + i.NoticeText;
            newLi.Controls.Add(anchor);
            ticker_02.Controls.Add(newLi);
        }

It's working fine when i add data in UL statically but when i give data through database it's don't work.
Posted
Updated 28-May-13 22:38pm
v2
Comments
Where the tick2() is getting called ?

1 solution

Just write following function at end of the body e.g.

HTML
<html>
<body>
.
.
.
.
.
.
<script type="text/javascript">
function tick2() {
  $('#ticker_02 li:first').slideUp(function () { 
     $(this).appendTo($('#ticker_02')).slideDown(); });
}
setInterval(function () { tick2() }, 3000);
</script>
</body>
</html>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900