Skip Navigation LinksHome / Community & Support / Code Library / WinForms > Rotator > Sample Code to Add Clickable Links to RadRotator

Not answered Sample Code to Add Clickable Links to RadRotator

Feed from this thread
  • Posted on Nov 3, 2011 (permalink)

    Requirements

    RadControls version    Q2 2011
    .NET version 4.0
    Visual Studio version  2010
    programming language VB
    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    I needed to put a news section in our desktop app to mirror a news feed on our website.  The news comes in a data table with a column for description and one for link. I used the following code to make this work.  This is very simplified, I just couldn't find a place to do it and figured I'd share.  

    In the form_load

     Dim dt As DataTable = {YOUR DATATABLE}
            For x As Integer = 0 To dt.Rows.Count - 1
    	'Create Link
                Dim news As New LinkLabel
                news.Text = dt.Rows(x).Item("Description")
                news.Links.Add(0, dt.Rows(x).Item("Description").ToString.Length, dt.Rows(x).Item("Link"))
    	'Add Handler for the Click
                AddHandler news.LinkClicked, AddressOf News_LinkClicked
    	'Add item to Rotator
                Dim rditm As New RadHostItem(news)
                rtrNews.Items.Add(rditm)
             Next
            rtrNews.Start()
    
    Then you need to add the function to open the link
    
    
      Private Sub News_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs)
            Process.Start(e.Link.LinkData.ToString)
        End Sub

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Nov 9, 2011 (permalink)

    Hi Jeff,

    Thank you for sharing your approach with the community. I have updated your Telerik points for it.

    All the best,
    Nikolay
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Code Library / WinForms > Rotator > Sample Code to Add Clickable Links to RadRotator