Adding File Upload Functionality to the Jobs Module Sample from the Sitefinity SDK

Adding File Upload Functionality to the Jobs Module Sample from the Sitefinity SDK

April 26, 2013 0 Comments

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.

  1. Add file upload control to the frontend widget that submits job applications JobApplicationUpload.ascx and perform the upload of the document:
<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]);
           

 

progress-logo

The Progress Team

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.

Comments
Comments are disabled in preview mode.
Topics
 
 
Latest Stories in
Your Inbox
Subscribe
More From Progress
New_Mobile_Dev_Ebook_Progress_Website_Thumbail
The New Mobile Development Landscape
Download Whitepaper
 
IDC Spotlight Sitefinity Thumbnail
Choosing the Right Digital Experience Platform to Improve Business Outcomes
Download Whitepaper
 
TheFastestWayToBuildMobileAppsArtboard-2
The Fastest Way to Build Mobile Apps With Cloud Data
Watch Webinar