Hello, I am developing an information site for my company. So far I have developed a .Net user control that gathers a random business company from our sql server database and display it. My problem is this, I have business info in the database but no logo or images, so I was planning to use umbraco to store those logos and images for each business. However I don't see how can I associate these images to their own businesses.
Has someone implemented a similar situation? How do you manage these associations? How can a user upload an image in umbraco backoffice and associate with the correct business? Thank you.
1. Build a ascx usercontrol that contains a dropdownlist with the company name as text and id as value.
2. Go to Umbraco and create a new datatype, select the usercontrolwrapper and choose the usercontrol you've just created.
3. Create a new mediatype that basically looks like the regular mediatype, but with the added property containing your usercontrol datatype.
4. Whenever a mediaitem gets saved, hook up to the Umbraco AfterSave event and assign the umbracoFile (the url to the media item) to the company selected in the dropdownlist.
Let me know if this dosn't make any sense :-)
Also, keep in mind that this is just one way to do it.
dynamic content with images
Hello, I am developing an information site for my company. So far I have developed a .Net user control that gathers a random business company from our sql server database and display it. My problem is this, I have business info in the database but no logo or images, so I was planning to use umbraco to store those logos and images for each business. However I don't see how can I associate these images to their own businesses.
Has someone implemented a similar situation? How do you manage these associations? How can a user upload an image in umbraco backoffice and associate with the correct business? Thank you.
Hi pcorreia,
The way I would do this would be something like:
1. Build a ascx usercontrol that contains a dropdownlist with the company name as text and id as value.
2. Go to Umbraco and create a new datatype, select the usercontrolwrapper and choose the usercontrol you've just created.
3. Create a new mediatype that basically looks like the regular mediatype, but with the added property containing your usercontrol datatype.
4. Whenever a mediaitem gets saved, hook up to the Umbraco AfterSave event and assign the umbracoFile (the url to the media item) to the company selected in the dropdownlist.
Let me know if this dosn't make any sense :-)
Also, keep in mind that this is just one way to do it.
- Bo
Hi Bo,
That makes sense. I haven't thought of datatype but the way you described it seems doable.
Thank you for the quick reply, I will try that way and then let you know how it went.
Hi pcorreia,
All good :) Just fire away if there's any trouble.
- Bo
is working on a reply...