FileField usage in widget designer
Hi,
I'm looking for code samples showing the usage of a FileField in a widget designer. At the moment, I have successfully created a FileField which shows up in my widget designer, but I doesn't work as expected. I can select a file, but the file cannot be saved.
And how can I display the library of documents of my Sitefinity website ?
Here is the code I'm using:
<
div
>
<
sf:SitefinityLabel
ID
=
"SitefinityLabel3"
runat
=
"server"
WrapperTagName
=
"h2"
HideIfNoText
=
"false"
Text
=
"File:"
/>
<
sitefinity:FileField
ID
=
"FileSelector"
runat
=
"server"
DisplayMode
=
"Write"
DataFieldName
=
"File"
/>
</
div
>
protected
override
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
// set the image selector type to use string (src)
FileSelector.MaxFileCount = 1;
FileSelector.ItemName =
"File"
;
FileSelector.ItemNamePlural =
"File"
;
FileSelector.IsMultiselect =
false
;
FileSelector.LibraryContentType =
typeof
(Telerik.Sitefinity.Libraries.Model.Document);
FileSelector.DisplayMode = FieldDisplayMode.Write;
/// <summary>
/// Gets the file selector.
/// </summary>
protected FileField FileSelector
get return Container.GetControl<FileField>("FileSelector", true);
Hello Julien,
Please check the following blog post:
http://www.sitefinity.com/blogs/joshmorales/posts/11-10-05/selecting_sitefinity_4_content_inside_widget_designers.aspx
I think you would find useful information there.
Hi,
Thanks for the blog post, but I already read that article and it doesn't explain the usage of FileField, but only ImageField which is quite different since it is fully integrated in the widget designer. The FileField seems to redirect to a new page allowing file management.
I searched a lot of articles but didn't found any explanation about the FileField !
Thanks
Julien T.
Hello Goulutor,
There aren't currently any documentation about the FileField. I have started a series of blog posts that will try to explain in details how to use the different selectors and fields in Sitefinity. Here is the first article in the series:
http://www.sitefinity.com/blogs/lubomirvelkov/posts/11-11-30/using_sitefinity_s_selectors_in_custom_field_controls_-_part_1_-_page_selector_field.aspx
I will try to publish a second article by the end of the year about ImageSelector and FileField selector.
It's been over a year since these posts. Was there ever a blog post or documentation on how to use the FileField in a widget designer? I looked at your blog but I didn't see you ever make a post giving instructions on this. The help documents I have found only show us how to use the ImageField and Page Selectors but not the FileField. Can you please explain how to use the FileField selector in the widget designer?
Hello,
Would it be possible to describe the scenario you are trying to achieve? Are you trying to upload files or select files that are already uploaded?
Greetings,