Link to home
Create AccountLog in
Avatar of sammySeltzer
sammySeltzerFlag for United States of America

asked on

Convert static scroller to dynamic scroller

Greetings mates,

Still trying to steady myself on .net.

So far, the following code works great.

However, I am trying to make it dynamic so news from be sampled from the db.

Any assistance is appreciated.

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        NewsScroller1.newsText = " 07 July 2010 - welcome to the new world of innovative and amazing Asp.net <br /> ..<a href='#' class='linknews'>More</a> <br /><br />" & _
                                 " 06 July 2010 - This is example of veritcal news scroller user control demo <br /> ..<a href='#' class='linknews'>More</a> <br /><br />"         NewsScroller1.box_TextColor = "#0000ff"
       

    End Sub
End Class

Open in new window

Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image

ASKER CERTIFIED SOLUTION
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of sammySeltzer

ASKER

Actually, I don't want the points awarded to me.
I want this question deleted as I have been able to resolve it myself.

I posted a question asking how I could convert a static message to database-driven message but ended up figuring up the answer myself.

Below is my solution:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim cmdcommand As OleDBCommand
        Dim objDataReader As OleDBDataReader
        Dim strScrolling As String = ""
        Dim cellScrolling As New HtmlTableCell()

        Dim strSQL As String
        Dim Conn As OleDbConnection
        Conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("App_Data\Countries.mdb"))
        Conn.Open()
        'Check which action were selected, edit the dept
        strSQL = "SELECT newsId, datecreated, newtitle FROM tbl_News WHERE Date() >= dateCreated order by dateCreated desc"
        'Response.Write(strSQL)
        'Response.End()
        cmdcommand = New OleDbCommand(strSQL, Conn)

        'Get a datareader
        objDataReader = cmdcommand.ExecuteReader()

        While objDataReader.Read()
            NewsScroller1.newsText = "<a href='#' OnClick=" & "javascript:window.open('newsDetail.aspx?NewsId=" & objDataReader.GetValue(0) & "','NewsDetail','width=400,height=400;toolbar=no;');" & "><font face='verdana' size='2' color='#184D68'>" & objDataReader.GetValue(1) & "</a>&nbsp;&nbsp;-&nbsp;&nbsp;" & objDataReader.GetValue(2).ToString() & "</font><br><br>"

        End While

    End Sub