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

Posted on 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

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation