Problems with PublishingWebControls, please help!
Hi everybody!! I need your help, please...
I have created a Master page (.master) and a Page Layout (.aspx) (with my own CSS file and applying a theme).
It all works ok, but my problem is the next: In the Page Layout, I want to use severals PublishingWebControls (7 RichImageField and 7 RichHtmlField); the purpouse is that the user could choose the image he wants and later, write the text according with the image (for example, the image of a new pc and its characteristics). I wrote the controls in the layout:
<PublishingWebControls:RichImageField id="ImageField2" FieldName="PublishingPageImage" runat="server"/>
and I change the ID for all of them.
The problems is that, when I try to "edit page" and choose a image and text and I publish, all the images are the same and, nevermind what I have wrote in the text or what image I have choosen, all is the same. If I choose a image of a dog and I wrote "guau, guau", in the others 6 controls appears the same dog and the same text.
It´s possible to put the controls (RichImageField and RichHtmlField) 7 times and that they can work independently or I can´t repeat them?
I´ll be very grateful for your repplies, I have no idea how can I solve this problem... Thank you very much!!!
MJ
Answers
Hi there
I think I know what you have done. I think you have copied the existing publishingwebcontrol in the code and just renamed the id. (If not then just ignore this) but if so, you need to understand that the publishingwebcontrol is actually a custom site column attached to the page layout content type that you selected.
Basically, think of the publishing blocks on SharePoint pages as metadata columns. To add multiple publishing controls on a page you need to create multiple publishing columns and attach them to the content type.
So to do this, first create a site column "mypublishing". Just use a string to start or multiline column. Next find the content type that associates to the page layout you used. If you look under the group “page layouts content types” you should find it there. (Remember best way is actually to also create your own page layout content type). Once you have found it just add your custom site column and ok that.
Now if you refresh your page in designer, if you look down the list of tools in your toolbox for your site (where you find all the forms tools, asp tools and SharePoint tools) at the bottom you will see Page fields group controls and hopefully your custom field.
Drag it onto the page and save it. Now if you edit you page in SharePoint and add text to it, it will be different to the other blocks.
Long rely. Sorry ;-)
Anyway good luck and hope you manage.
Kind Regards
RiccardoThanks a lot, Riccardo!!!!! I have made the changes and all works fine!!! I'm sure I couldn't do it without your explanations, so, thanks and thanks a lot... I was very long time trying and trying and failing all time (because I didn't use neither think in Content types, only copied the publishing control), and the worst, with any good idea about how to solve the problem...
Good job and thanks again!!
MJ
All Replies
Hi there
I think I know what you have done. I think you have copied the existing publishingwebcontrol in the code and just renamed the id. (If not then just ignore this) but if so, you need to understand that the publishingwebcontrol is actually a custom site column attached to the page layout content type that you selected.
Basically, think of the publishing blocks on SharePoint pages as metadata columns. To add multiple publishing controls on a page you need to create multiple publishing columns and attach them to the content type.
So to do this, first create a site column "mypublishing". Just use a string to start or multiline column. Next find the content type that associates to the page layout you used. If you look under the group “page layouts content types” you should find it there. (Remember best way is actually to also create your own page layout content type). Once you have found it just add your custom site column and ok that.
Now if you refresh your page in designer, if you look down the list of tools in your toolbox for your site (where you find all the forms tools, asp tools and SharePoint tools) at the bottom you will see Page fields group controls and hopefully your custom field.
Drag it onto the page and save it. Now if you edit you page in SharePoint and add text to it, it will be different to the other blocks.
Long rely. Sorry ;-)
Anyway good luck and hope you manage.
Kind Regards
RiccardoThanks a lot, Riccardo!!!!! I have made the changes and all works fine!!! I'm sure I couldn't do it without your explanations, so, thanks and thanks a lot... I was very long time trying and trying and failing all time (because I didn't use neither think in Content types, only copied the publishing control), and the worst, with any good idea about how to solve the problem...
Good job and thanks again!!
MJ
- Riccardo,
What if you want to do this using Visual Studio 2005 and not Designer. How do you do this? I created a program that makes content types HTML and Image, but when I drag and drop them on a page layout they do not show up in the SharePoint UI unless I created the Content type on the SharePoint UI. Is this a bug, or is there special code in .aspx that I will need to use to have richimage -> richconent going down the page 7 times.
Kimberly M.


