0

I want to connect picture library with a webpart. I have 3 light as pictures (green, yellow and red) for commands. I want to have the most simple way to make a command ( for example: process is completed and then it shows green light) and apply it on picture.

  • Could you be more specific please? Do you need a WebPart to show these pictures? – Alvmad Sep 6 '13 at 12:12
0

if its in a webpart why are you not storing the images (i presume they are allways green,orange and red) within styles library?

within your code have a function that checks and changes the image accordingly?

if your insistant on the doc library and you know its the same values everytime than do:

SPWeb Web = SPContext.Current.Web;

SPPictureLibrary pictures = (SPPictureLibrary)web.Lists["my home Photos"];

the above needs to be within creatchildcontrols or called from. After that you can so somthing like:

string sourceurl = Web.Url + "/" + pictures.Items[index].Url;

this.Controls.Add(new LiteralControl("<img src='" + sourceurl + "' height='200' />");

above needs to also be within creatchildcontrols ;) , index refers to the item number within the list! so if you have green orange red that would be (0) green, (1) orange, (2) red.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.