My PhotoBruno Brás Silva

09, April 1986

info@brunosilva.net

Sintra Lisbon Portugal

Slide.Show - Generate data.xml using ASP.NET

Posted on 4:33pm 3/19/2008 by Bruno Silva in .NET, ASP.NET, Programming, Silverlight, Web

A while ago I talked about Slide.Show. Some one asked me how to dynamically look into a folder and create a slide show based on its contents. I suggested using an ASP.NET page that looks into the folder and generates a XML output that can be used by Slide.Show as a data source.

I’ve implemented a simple version that shows how to do it. Download it and change it as you wish.

Take a look at DataProvider.js where I have changed the Data.xml reference to Data.aspx file.

In the Data.aspx file I’ve deleted all the HTML output, and in the Page_Load event handler generated XML output.

Response.ClearContent();
Response.ContentType = “Application/xml”;
Response.Write(”{XML output}”);
Response.End();

I’ve included in the zip file only the required files to let the example work. It has only 1 image. I hope it will be useful to someone. :)

13 Responses to “Slide.Show - Generate data.xml using ASP.NET”

  1. Bruno, great Job. The only thing, i can’t figure out how to pass folder name from html page when, i’m creating slideshow control.
    new SlideShow.Control(new SlideShow.XmlConfigProvider(foldName:????));

    Thanx again.

  2. You can do this:
    create a dynamic generated configuration.xml (such as Configuration.aspx).
    When creating the XMLConfigProvider, provide an url such as
    new SlideShow.Control(new SlideShow.XmlConfigProvider({url:”Configuration.aspx?folder=XXX”}));
    Then when you generate the Configuration.xml, you add an option to the DataProvider, where you put the url Data.aspx?folder=(parameter).

  3. Thanx a lot. Let me try.

  4. I got it to work with your help.
    Thanx a lot again for your help.

  5. Hello Bruno,

    I make a dynamic SlideShow with your tutorial and it works. But now i have a caching Problem. When i take a new picture in a Folder and refresh the SlideShow-Site nothing happens. How can i force the browser to get a new Data.xml File an didnt take the old Version in his Cache?

  6. Hi Bruno

    Thanks for the code it works; but i want a small help from you; I am using this slide show in share point site. Sharepoint got Image library there in Photos Folder i put all my image now i want to link all thease photos to view in the slide show.

    I tried in asp.net site and the code works there but in share point when ever i use nothing comes up.

    Can you please help me how to link it with the Photos folder or subfolders;

    Thanks
    Mehfuz

  7. Well done to look in a folder and make the slide show.
    But I’m looking to a solution that can use a sql server database image, write it on the xml file instead of in a folder, or write the image on a folder and then use this xml to read it.

    Any sugestions?
    Thank you

  8. Let me see if I understand. You want to show a gallery using photos stored in a database?
    You can generate an xml with the list of photos to display, where the url will be something like “http://website/loadPhoto.aspx?idPhoto=1234″

  9. Hi, Bruno!
    thanks for your tip…
    i also want to show something like
    http://website/loadPhoto.aspx?idPhoto=1234 which will generate an XML
    any help on that will be greatly appreciated, thanx

  10. In my example http://website/loadPhoto.aspx?idPhoto=1234 would not generate an XML, it would load a single image stored in the database.
    The generation of a XML with the list of images is the original example that I posted.

    Maybe I am not quite understanding your question. If you explain it again, I’ll be glad to help you.

  11. Hey Bruno,

    How do i pass the config file as a string variable instead of a string constant.

    i would like to do the following

    string urlString = “./ConfigFiles/Config1.xml”
    new SlideShow.Control(new SlideShow.XmlConfigProvider({url: urlString }));

    the above does not work.

  12. In their website Vertigo use
    new SlideShow.Control(new SlideShow.XmlConfigProvider({ url: “/SlideShow/Main/Configuration.xml” }));
    In the code you’ve written there’s a missing ; in the first line (don’t know if was only here :) )

    If the code you have shown doesn’t work, try an absolute URL starting at the website root, like they did.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Bruno Silva | Powered by Wordpress