Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Rotator > Web Browser in Rotator?

Not answered Web Browser in Rotator?

Feed from this thread
  • Richard Thurgood avatar

    Posted on Jul 16, 2008 (permalink)

    Hi guys,
    I'd like to dynamically create and load a web browser control in the rotator.  The web browser control will be used to show either a PDF or an image depending on the data I have stored. 

    foreach(DataRow dr in MyTable.Rows)
    {
        //todo: create browser control

        if (IsPDF)
       {
            //todo: load PDF (from field in datarow) into browser control
        }
        else
        {
            //todo: load IMAGE (from field in datarow) into browser control
        }

        //todo: load browser control into radRotator
    }

    Reply

  • Richard Thurgood avatar

    Posted on Jul 16, 2008 (permalink)

    Okay, perhaps I was premature in asking. The answer is "YES", you can add a browser control to a radRotator.

    I whipped up something real quick to illustrate......

    private void PopulateBrowserControl()
    {
     for (int i = 1; i < 10; i++)
     {
      WebBrowser browser = new WebBrowser();
      browser.Navigate("about:blank");
      while (browser.ReadyState != WebBrowserReadyState.Complete)
      {
       Application.DoEvents();
      }
      browser.Document.Body.InnerHtml = "Page " + Convert.ToString(i);
      PopulateRotator(browser);
     }
     radRotator1.Goto(0);
    }

    private void PopulateRotator(WebBrowser browser)
    {
     radRotator1.Items.Add(new RadHostItem(browser));
    }

     

    Reply

  • Mike Mike admin's avatar

    Posted on Jul 17, 2008 (permalink)

    Hi Richard,

    It is great you found out the solution alone. Allow me one addition, though. You can also use the specialized RadWebBrowserElement, which inherits RadHostItem and wraps up the WebBrowser control for you. The advantages consist in the ability to add this item in RadRotator, RadCarousel and other controls using the Visual Studio designer.

    Don't hesitate to contact us if you have further questions.

    Sincerely yours,
    Mike
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Richard Thurgood avatar

    Posted on Jul 17, 2008 (permalink)

    That's awesome. Can you retro-fit my example to show how to use it?

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Jul 17, 2008 (permalink)

    Hi Richard,

    As Mike said, the only advantage you will get by using RadWebBrowserElement is that you can add it at design-time in the RadRotator's Items collection, using the Visual Studio designer. However, since you are using the programmatic approach, which is good enough in this case, you do not need the RadWebBrowserElement.

    If you have additional questions, feel free to contact me.

    Regards,
    Nikolay
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Rotator > Web Browser in Rotator?
Related resources for "Web Browser in Rotator?"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]