The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
This blog post provides a sample which extends the Jobs module sample in the Sitefinity SDK so as to allow upload of files to the job application and to display a link to the uploaded files in the list of submitted applications.
Here is the sample code with the below implementations.
<
telerik:RadUpload
ID
=
"RadUpload1"
runat
=
"server"
AllowedFileExtensions
=
".doc,.docx,.pdf,.txt,.rtf,.odt"
MaxFileInputsCount
=
"1"
Width
=
"100%"
InputSize
=
"45"
ControlObjectsVisibility
=
"None"
/>
<
br
/>
<
asp:TextBox
ID
=
"CV"
runat
=
"server"
Width
=
"100%"
MaxLength
=
"40"
/>
Add the logic for document uploading in JobApplicationUpload.cs in UploadApplication method. I have put comments in the method and hope you will be able to make use of them.
2.Add additional column in jobs module uploaded items grid to render a link to the uploaded file
The tricky part is to render the link to the uploaded document in the grid among the other fields. The UploadApplicaiton method returns the link to the document (its a full link that allows you to download or display a document in the browser depending on the document extension ".doc, .pdf").
To render the link as <a> tag in the client template of the grid column use this in JobsDefinitions.cs
Add new DataColumnElement to display the uploaded file link. I have associated the uploaded file with the column LastName and the client template for LastName will display <a> like below:
DataColumnElement lastNameColumn =
new
DataColumnElement(gridMode.ColumnsConfig)
{
Name =
"LastName"
,
HeaderText = Res.Get<JobsResources>().LastName,
ClientTemplate =
"<a sys:href=\"{{LastName}}\">{{LastName}}</a>"
,
HeaderCssClass =
"sfRegular"
,
ItemCssClass =
"sfRegular"
};
gridMode.ColumnsConfig.Add(lastNameColumn);
And finally, the place to map the uploaded file to one of the Grid columns is:
private
void
JobApplicationUpload_Click(
object
sender, EventArgs e)
{
//the ID of the Job
var jobApplicationID = Guid.NewGuid();
var manager =
new
JobsManager();
var application = manager.CreateJobApplication(jobApplicationID);
application.FirstName =
this
.FirstName;
//addition of the uploaded file
application.LastName = UploadApplication(
this
.RadUpload1.UploadedFiles[0]);
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.