I have integrated ckeditor in my asp.net and vb.net web application. previously This web appilication was using bootstrap-wysihtml5. but now the clients require to use ckeditor.
To integrate ckeditor I have done the following
i am using ckeditor_4.4.1 . I have copied the ckeditor folder in root directory. and linked it in the master page. like the following.
The ckeditor toolbar is showing on the textarea.But website can't recognize the value that is written in the ckeditor field nor does it save those value in the database. Even when I submit the form after writting on the text area it is not allowing me to
submit form as the description field have to have some text. But I actually wriiten in the textarea or copy paste from wordfile. but it just doesnot gets any value.
Please help me with code
It doesnot has to be ck editor. it can be tinymce or niceedit.
It is a long file. any way i am including it . the required text area has id="txtDescription" name="txtDescription" class="edr" and runat="server"
Imports System.Threading
Imports NLog
Partial Class E4_Jobs_new
Inherits System.Web.UI.Page
Private _logger As Logger = LogManager.GetCurrentClassLogger()
Private _vacancy As Vacancy
Public ReadOnly Property Mode() As String
Get
Return CStr(Request("mode"))
End Get
End Property
Public ReadOnly Property ModeID() As Integer
Get
Return CInt(Request("v"))
End Get
End Property
Public Property Vacancy() As Vacancy
Get
Return _vacancy
End Get
Set(ByVal value As Vacancy)
_vacancy = value
End Set
End Property
Public ReadOnly Property Employer() As Employer
Get
Return New Employer(LocalHelper.UserEmployerID())
End Get
End Property
Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
If Not Vacancy.Accessible(CInt(Request("v"))) AndAlso Request("mode").Equals("edit") Then Response.Redirect("/E4/Error/403.aspx")
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
If Mode.Equals("new") Then
'Create draft on new jobs and Start editing draft
Dim draft = New Vacancy()
draft.EmployerID = LocalHelper.UserEmployerID()
draft.SaveAsDraft()
Response.Redirect("new.aspx?mode=draft&v=" & draft.DraftId)
ElseIf Mode.Equals("clone") AndAlso ModeID > 0 Then
'Create draft while cloning
Response.Redirect("new.aspx?mode=draft&v=" & Vacancy.CopyToDraft(ModeID))
ElseIf Mode.Equals("template") AndAlso ModeID > 0 Then
'Create draft while cloning
Response.Redirect("new.aspx?mode=draft&v=" & Vacancy.CloneDraft(ModeID))
End If
If Mode.Equals("draft") AndAlso ModeID > 0 Then
'Load draft
Vacancy = New Vacancy()
Vacancy.LoadDraft(ModeID)
If Vacancy.Template AndAlso Vacancy.DraftId > 0 Then
Template.Value = "True"
btnSave.Text = "Save template"
End If
ElseIf Mode.Equals("edit") Then
'Load vacancy
Vacancy = New Vacancy(ModeID)
End If
'set defaults
txtClosingDate.Value = Today.AddMonths(1).ToString("dd-mm-yyyy")
chkDisplayClosingDate.Checked = Vacancy.DisplayClosingDate
comJobType.SelectedIndex = 0
comJobHours.SelectedIndex = 0
txtPostcode.Value = Employer.PostCode
Helper.SetInputListIDs(comSector, Employer.SectorID)
chkAllowCandidateAttachment.Checked = False
chkCovernoteRequired.Checked = True
'Populate lists
comLocation.DataSource = DB.GetData("SELECT id, name FROM location WHERE deleted = 0 ORDER BY name")
comLocation.DataBind()
chkDisplayLocation.Checked = Vacancy.DisplayMap
If Mode.Equals("edit") Then
comAgencyPercentage.DataSource = DB.GetData("SELECT id,name FROM introductionfee WHERE percentage >= @per ", Core.DB.SIP("per", Vacancy.IntroductionFeePercentage))
comAgencyPercentage.DataBind()
comReferrerPercentage.DataSource = DB.GetData("SELECT id,name FROM referrerfee WHERE percentage >= @per ", Core.DB.SIP("per", Vacancy.ReferrerFeePercentage))
comReferrerPercentage.DataBind()
Else
LocalHelper.BindInputList(comAgencyPercentage, "introductionfee", "<< select >>")
LocalHelper.BindInputList(comReferrerPercentage, "referrerfee", "<< select >>")
End If
comRetainedAgency.DataSource = LocalHelper.CachedAgencyList()
comRetainedAgency.DataBind()
comRetainedAgency.Items.Insert(0, New ListItem("none", -1))
comPSL.DataSource = DB.GetData("SELECT [EmployerPSLList].id AS 'id', [EmployerPSLList].name AS 'name' FROM EmployerPSLList WHERE [EmployerPSLList].deleted = 0 AND [EmployerPSLList].employerid = @employerid ORDER BY [EmployerPSLList].name", Core.DB.SIP("employerid", LocalHelper.UserEmployerID()))
comPSL.DataBind()
comPSL.Items.Insert(0, New ListItem("none", -1))
Dim brnds = LocalHelper.CachedBrandingList(LocalHelper.UserEmployerID())
comBrandingID.DataSource = brnds
comBrandingID.DataBind()
If brnds.Rows.Count <= 0 Then
comBrandingID.Items.Insert(0, New ListItem("Default Brand", "-1"))
End If
comBrandingID.SelectedIndex = 0
comDepartment.DataSource = DB.GetData("select id, name from department where employerid = @eid", DB.SIP("eid", LocalHelper.UserEmployerID()))
comDepartment.DataBind()
comDepartment.Items.Insert(0, New ListItem("Not specified", ""))
comMainContact.DataSource = LocalHelper.CachedEmployerUserList(LocalHelper.UserEmployerID)
comMainContact.DataBind()
comUsersWithAccess.DataSource = LocalHelper.CachedEmployerUserList(LocalHelper.UserEmployerID)
comUsersWithAccess.DataBind()
comSector.DataSource = DB.GetData("select id, name from sector where deleted = 0 order by name")
comSector.DataBind()
Dim srvs = DB.GetData("select id, title from survey where deleted = 0 and employerid = @eid", Core.DB.SIP("eid", LocalHelper.UserEmployerID()))
If srvs.Rows.Count > 0 Then
comSurvey.DataSource = srvs
comSurvey.DataBind()
comSurvey.Items.Insert(0, New ListItem("none", ""))
Else
comSurvey.Enabled = False
End If
txtTitle.Value = Vacancy.Title
txtDisplaySalary.Value = Vacancy.DisplaySalary
Helper.SetInputListIDs(comLocation, Vacancy.LocationID)
txtPostcode.Value = Vacancy.Postcode
txtDescription.Value = Vacancy.Summary.Replace(Environment.NewLine, "<br/>")
txtClosingDate.Value = IIf(Vacancy.Expires < Today AndAlso Mode.Equals("draft"), Today.AddMonths(1).ToString("dd-MM-yyyy"), Vacancy.Expires.ToString("dd-MM-yyyy"))
Helper.SetInputListID(comJobType, Vacancy.JobTypeID)
Helper.SetInputListID(comJobHours, Vacancy.JobHoursID)
Helper.SetInputListID(comContractLength, Vacancy.ContractLength)
Helper.SetInputListID(comFeeType, Vacancy.FeeType)
Helper.SetInputListID(comCurrency, Vacancy.CurrencyID)
txtMinSalary.Value = Vacancy.SalaryFrom.ToString("##")
txtMaxSalary.Value = Vacancy.SalaryTo.ToString("##")
Helper.SetInputListID(comAgencyPercentage, DB.GetInteger("SELECT id FROM introductionfee WHERE percentage = " & Vacancy.IntroductionFeePercentage))
Helper.SetInputListID(comRetainedAgency, Vacancy.ApplyRetainedAgencyID)
Helper.SetInputListID(comPSL, Vacancy.ApplyPSLID)
Helper.SetInputListID(comReferrerPercentage, DB.GetInteger("SELECT id FROM referrerfee WHERE percentage = " & Vacancy.ReferrerFeePercentage))
Helper.SetInputListID(comPSL, Vacancy.ApplyPSLID)
chkSignOn.Checked = Not Vacancy.NoCandidateBonus
chkScreening.Checked = Vacancy.Mpbresourcing
ctrApplicationQuestions.ApplicationQuestions = ApplicationQuestions.FromXml(Vacancy.QuestionXml)
Helper.SetInputListIDs(comSector, Vacancy.SectorID)
If Vacancy.SurveyId.HasValue Then
Helper.SetInputListID(comSurvey, Vacancy.SurveyId.Value.ToString())
End If
Helper.SetInputListID(comBrandingID, Vacancy.ApplyBrandID)
comDepartment.SelectedValue = Vacancy.Department
Helper.SetInputListID(comMainContact, Vacancy.ConsultantUserID)
Helper.SetInputListIDs(comUsersWithAccess, Vacancy.UsersWithAccessID)
txtRef.Value = Vacancy.Ref
txtPon.Value = Vacancy.PurchaseOrderNum
Helper.SetInputListIDs(comSector, Vacancy.SectorID)
If Vacancy.SurveyId.HasValue Then Helper.SetInputListID(comSurvey, Vacancy.SurveyId.ToString())
If Vacancy.SurveyId.HasValue Then chkSurveyAnnonymous.Checked = Vacancy.SurveyAnnonymous
txtAdditionalCost.Value = Vacancy.AdditionalCost.ToString("##")
txtAdditionalCostSummary.Value = Vacancy.AdditionalCostDescription
txtApplicationNote.Value = Vacancy.ApplicationNote
chkAllowCandidateAttachment.Checked = Vacancy.AllowCandidateAttachment
chkCovernoteRequired.Checked = Vacancy.CoverNoteRequired
hdnAwaitingApproval.Value = Vacancy.AwaitingApproval.ToString()
hdnApprovalSend.Value = Vacancy.ApprovalSend.ToString("dd MMM yyyy HH:mm")
hdnApproved.Value = Vacancy.Approved.ToString()
hdnApprovedAt.Value = Vacancy.Approvedat.ToString("dd MMM yyyy HH:mm")
If Vacancy.InternalJob Then
hdnPublishOption.Value = "internal"
ElseIf Not Vacancy.PublicJob Then
hdnPublishOption.Value = "confidential"
Else
hdnPublishOption.Value = "public"
End If
End If
End Sub
Private Sub PopulateVacancy()
If Mode.Equals("draft") Then
Vacancy = New Vacancy()
Else
Vacancy = New Vacancy(ModeID)
End If
With Vacancy
.DraftId = CInt(IIf(Mode.Equals("draft"), ModeID, 0))
.EmployerID = LocalHelper.UserEmployerID()
If hdnPublishOption.Value.Equals("internal") Then
.InternalJob = True
ElseIf hdnPublishOption.Value.Equals("confidential") Then
.PublicJob = False
.InternalJob = False
Else
.PublicJob = True
.InternalJob = False
End If
.Title = Left(txtTitle.Value.Trim(), 64)
.DisplaySalary = Left(txtDisplaySalary.Value, 64)
.LocationID = Helper.GetInputListIDs(comLocation)
.DisplayMap = chkDisplayLocation.Checked
.Postcode = Left(txtPostcode.Value.Replace(" ", ""), 10)
.Summary = txtDescription.Value
.Expires = CDate(txtClosingDate.Value)
.DisplayClosingDate = chkDisplayClosingDate.Checked
.JobTypeID = CInt(comJobType.Value)
.JobHoursID = CInt(comJobHours.Value)
If .JobTypeID = 3 Then .ContractLength = CInt(comContractLength.Value)
If Not String.IsNullOrEmpty(MediaLists.Value) Then
.MediaList = MediaLists.Value
End If
.FeeType = CInt(comFeeType.Value)
.CurrencyID = CInt(comCurrency.Value)
If IsNumeric(txtMinSalary.Value) AndAlso IsNumeric(txtMaxSalary.Value) Then
.SalaryFrom = CDec(txtMinSalary.Value)
.SalaryTo = CDec(txtMaxSalary.Value)
End If
'On variable fee set noagencyfee false but % 0
If CInt(comFeeType.Value) = 2 Then
.NoAgencyFee = False
.IntroductionFeePercentage = 0
If Retained.Value.Equals("1") AndAlso comRetainedAgency.SelectedIndex > 0 Then
.ApplyRetainedAgencyID = CInt(comRetainedAgency.SelectedValue)
ElseIf comPSL.SelectedIndex > -1 Then
.ApplyPSLID = CInt(comPSL.SelectedValue)
End If
ElseIf CInt(comFeeType.Value) < 2 Then
If comAgencyPercentage.SelectedValue > 0 Then
Dim ap = CDec(DB.GetString("SELECT percentage FROM introductionfee WHERE id = " & comAgencyPercentage.SelectedValue))
If ap > 0 Then
.NoAgencyFee = False
.IntroductionFeePercentage = ap
If Retained.Value.Equals("1") AndAlso comRetainedAgency.SelectedIndex > 0 Then
.ApplyRetainedAgencyID = CInt(comRetainedAgency.SelectedValue)
ElseIf comPSL.SelectedIndex > -1 Then
.ApplyPSLID = CInt(comPSL.SelectedValue)
End If
Else
.NoAgencyFee = True
End If
End If
End If
If comReferrerPercentage.SelectedValue > 0 Then
Dim rp = CDec(DB.GetString("SELECT percentage FROM referrerfee WHERE id = " & comReferrerPercentage.SelectedValue))
If rp > 0 Then
.NoReferrerFee = False
.ReferrerFeePercentage = rp
.NoCandidateBonus = Not CBool(chkSignOn.Checked)
Else
.NoReferrerFee = True
End If
End If
.Mpbresourcing = CBool(chkScreening.Checked)
.QuestionXml = ctrApplicationQuestions.ApplicationQuestions.ToXML()
.Ref = Left(txtRef.Value, 30)
.PurchaseOrderNum = Left(txtPon.Value, 30)
.SectorID = Helper.GetInputListIDs(comSector)
If comSurvey.Enabled AndAlso Not String.IsNullOrWhiteSpace(comSurvey.SelectedValue) Then
.SurveyId = New Guid(comSurvey.SelectedValue)
.SurveyAnnonymous = chkSurveyAnnonymous.Checked
End If
.ApplyBrandID = DB.GetInteger("SELECT id FROM employerbrand WHERE id = " & comBrandingID.SelectedValue)
.Department = comDepartment.SelectedValue
.ConsultantUserID = CInt(comMainContact.SelectedValue)
.ContactUserID = CInt(comMainContact.SelectedValue)
.UsersWithAccessID = Helper.GetInputListIDs(comUsersWithAccess)
If IsNumeric(txtAdditionalCost.Value) Then .AdditionalCost = CDec(txtAdditionalCost.Value)
.AdditionalCostDescription = txtAdditionalCostSummary.Value
.ApplicationNote = Left(txtApplicationNote.Value.Trim(), 500)
.AllowCandidateAttachment = chkAllowCandidateAttachment.Checked
.CoverNoteRequired = chkCovernoteRequired.Checked
.AwaitingApproval = CBool(hdnAwaitingApproval.Value)
.ApprovalSend = CDate(hdnApprovalSend.Value)
.Approved = CBool(hdnApproved.Value)
.Approvedat = CDate(hdnApprovedAt.Value)
.Closed = False
.CalculateFees()
End With
'_logger.Info(Helper.TruncateString(LocalHelper.StripHTML(txtDescription.Value), 4500, ""))
End Sub
Protected Sub btnPreview_Click(sender As Object, e As EventArgs) Handles btnPreview.Click
If Page.IsValid Then
PopulateVacancy()
If Mode.Equals("draft") Then
Vacancy.SaveAsDraft()
Response.Redirect("preview.aspx?v=" & Vacancy.DraftId)
End If
End If
End Sub
Protected Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
If Page.IsValid Then
If CBool(Template.Value) Then
PopulateVacancy()
Vacancy.Template = True
Vacancy.SaveAsDraft()
Response.Redirect("templates.aspx")
Else
PopulateVacancy()
If Mode.Equals("draft") Then
Vacancy.SaveAsDraft()
Response.Redirect("draft.aspx")
ElseIf Mode.Equals("edit") Then
Vacancy.Save()
Vacancy.SaveFees()
Vacancy.CacheMatches()
Response.Redirect("new-complete.aspx?t=edit&v=" & Vacancy.ID)
End If
End If
End If
End Sub
Protected Sub ApplicationsQuestionsModeValidator_ServerValidate(source As Object, args As ServerValidateEventArgs) Handles ApplicationsQuestionsModeValidator.ServerValidate
args.IsValid = Not ctrApplicationQuestions.IsInEditMode()
End Sub
Protected Sub btnSaveTemplate_Click(sender As Object, e As EventArgs) Handles btnSaveTemplate.Click
If Page.IsValid Then
PopulateVacancy()
Vacancy.Template = True
Vacancy.SaveAsDraft()
Response.Redirect("templates.aspx")
End If
End Sub
Protected Sub FeesValidator_ServerValidate(source As Object, args As ServerValidateEventArgs) Handles FeesValidator.ServerValidate
'If comAgencyPercentage.SelectedValue > 0 Then
' If comFeeType.Value.Equals("0") AndAlso (String.IsNullOrWhiteSpace(txtMinSalary.Value) Or Not String.IsNullOrWhiteSpace(txtMaxSalary.Value)) Then
' FeesValidator.ErrorMessage = "Please enter a min amd max salary for Fixed fee type."
' args.IsValid = False
' End If
'End If
End Sub
End Class
and the following is the javascript which was included at the bottom of the frontend page.
the backend vb.net is following
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="Server">
<script src="/_resx/js/jquery.uploadify.min.js"></script>
<!-- Added by Bashabi on 03-06-2014 by Bashabi. the following line of source has been referenced in order change the wysihtml script. Shariful used Bootstrap-wysihtml5 script. Now it is changed to ckeditor for better performance of copy and paste.-->
<!-- <script src="/Scripts/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="/Scripts/ckeditor/adapters/jquery.js" type="text/javascript"></script>
<script src="/Scripts/tinymce/js/tinymce/tinymce.min.js" type="text/javascript"></script>-->
<!-- End of code (by Bashabi) -->
<!--<script src="/_resx/js/wysihtml5-0.3.0.min.js"></script>
<script src="/_resx/js/bootstrap-wysihtml5.js"></script>
<script src="/tinymce/js/tinymce/tinymce.min.js" type="text/javascript"></script>-->
<script type="text/javascript">
$(function () {
dimNav('vacancy');
$('#file_upload').uploadify({
'buttonClass': 'button2',
'buttonText': 'Select a PDF or DOCX file to upload..',
'width': 250,
'fileTypeExts': '*.pdf; *.doc; *.docx',
'formData': {
'draftId': id,
'type': mode
},
'uploadLimit': 3,
'swf': '/_resx/uploadify.swf',
'uploader': '/e4/jobs/upload-job-attachments.ashx',
'onUploadSuccess': function (file, data, response) {
$('#attachmentList').append('<li id="da' + data + '"><span>' + file.name + '</span><span class="rd" data-did="' + data + '"> remove</span></li>');
}
});
$('body').on('click', '.rd', function () {
var el = $(this);
$.post('delete-job-attachment.ashx?id=' + el.attr('data-did'), '{}', function () {
$('#da' + el.attr('data-did')).remove();
});
});
// the following line was used for bootstrap-wysihtml5 script. enable it if you want to activate the wysihtml5 script again instead of ckeditor
// $('.edr').wysihtml5();
// the following line was used for ckeditor script. This line of code added by Bashabi on 03-06-2014. Disable it and enable the previous line to activate the wysihtml5
// $('.edr').ckeditor();
$('.price-button').click(function () { $(this).next('.price-list').fadeToggle('slow'); });
$('.m-lists table tr:nth-child(4) td:nth-child(1)').prepend('<div>Multiple job posting</div>');
$('.jMedias').change(function () {
suffleMedias();
});
var suffleMedias = function () {
var mids = [];
$('.jMedias:checked').each(function () {
mids.push($(this).val());
});
$('.mediaLists').val(mids.toString());
};
$('.jType').change(function () {
suffleJobType();
});
$('input:radio.p-option-radio').change(function () {
var pOption = $(this).val();
$('.p-option').val(pOption);
});
var suffleJobType = function () {
var type = $('.jType').val();
if (type == 0) {
$('#contractLength, #jobHour').slideUp();
} else if (type == 1) {
$('#jobHour').slideDown();
$('#contractLength').slideUp();
} else if (type == 2) {
$('#jobHour').slideDown();
$('#contractLength').slideUp();
} else if (type == 3) {
$('#contractLength, #jobHour').slideDown();
}
};
var suffleFeeType = function () {
var fType = $('.feeType').val();
if (fType == 0) {
$('#salaryRateMax, #salaryRateMin, #agencyFee').slideDown();
} else if (fType == 1) {
if (parseFloat($('.referrerPercentage option:selected').text()) > 0) {
//$('#signOnBonus').slideDown();
} else {
$('#salaryRateMax, #salaryRateMin').slideUp();
}
$('#agencyFee').slideDown();
} else if (fType == 2) {
$('#agencyFee').slideUp();
if (parseFloat($('.referrerPercentage option:selected').text()) > 0) {
//$('#signOnBonus').slideDown();
} else {
$('#salaryRateMax, #salaryRateMin').slideUp();
}
}
};
$('.feeType').change(function () {
suffleFeeType();
});
$('.referrerPercentage').change(function () {
if (parseFloat($('.referrerPercentage option:selected').text()) > 0) {
//$('#salaryRateMax, #salaryRateMin, #signOnBonus').slideDown();
$('#salaryRateMax, #salaryRateMin').slideDown();
} else {
if ($('.feeType').val() == 1) {
$('#salaryRateMax, #salaryRateMin').slideUp();
}
}
});
$('.signOnYes input[type=checkbox]').change(function () {
if ($(this).is(':checked')) {
//$('#signonSummary').slideDown();
} else {
//$('#signonSummary').slideUp();
}
CalculateAndDisplayFees();
});
$('.calcFee').change(function () {
CalculateAndDisplayFees();
});
$('.rAgency').chosen().change(function () {
if ($(this).val() != '-1') {
$('.psls').val('-1').trigger("liszt:updated");
$('.retained').val('1');
}
});
$('.psls').chosen().change(function () {
if ($(this).val() != '-1') {
$('.rAgency').val('-1').trigger("liszt:updated");
$('.retained').val('0');
}
});
var setPublishOption = function () {
var p = $('.p-option').val();
var $radios = $('input:radio.p-option-radio');
$radios.filter('[value=' + p + ']').attr('checked', true);
};
suffleJobType();
suffleFeeType();
suffleMedias();
CalculateAndDisplayFees();
setPublishOption();
});
function CalculateAndDisplayFees() {
var fType = parseInt($('.feeType').val()),
currency = $('.feeCurrency option:selected').text(),
agencyPercentage = parseFloat($('.agencyPercentage option:selected').text()),
referrerPercentage = parseFloat($('.referrerPercentage option:selected').text()),
minSalary = parseFloat($('.minSalary').val()),
maxSalary = parseFloat($('.maxSalary').val()),
totalApayable = 0,
totalRefpayable = 0,
totalCanPayable = 0,
signOnYes = false, //$(".signOnYes input[type=checkbox]").is(':checked'),
medianSalary = median([minSalary, maxSalary]),
jobType = $('.jType option:selected').val(),
contractLength = $('.jClength option:selected').val(),
contractFactor = 1;
if (jobType == 3 && contractLength > 0 && contractLength < 12) {
contractFactor = contractLength / 12;
}
if (fType == 0 && agencyPercentage > 0) {
//fixed
totalApayable = (medianSalary * agencyPercentage / 100) * contractFactor;
totalApayable = isNaN(totalApayable) ? 0 : totalApayable;
$('#lblagencyFee').html(currency + ' ').append((totalApayable).formatMoney(2, '.', ','));
//$('#lbladFeeOnAgency').html(currency + ' ').append((totalApayable * 0.2).formatMoney(2, '.', ','));
//$('#lbltotalFeesOnIntroduction').html(currency + ' ').append(totalApayable.formatMoney(2, '.', ','));
} else if (fType == 1 && agencyPercentage > 0) {
//onSuccess
$('#lblagencyFee').html(agencyPercentage).append(' % of final salary');
//$('#lbladFeeOnAgency').html('1% of final salary');
//$('#lbltotalFeesOnIntroduction').html(agencyPercentage).append(' % of final salary');
} else if (fType == 2) {
$('#lblagencyFee').html('TBC');
$('#lbladFeeOnAgency').html('N/A');
$('#lbltotalFeesOnIntroduction').html('TBC');
} else {
$('#lblagencyFee').html(currency + ' 0.00');
//$('#lbladFeeOnAgency').html(currency + ' 0.00');
//$('#lbltotalFeesOnIntroduction').html(currency + ' 0.00');
}
totalRefpayable = (medianSalary * referrerPercentage / 100) * contractFactor;
totalRefpayable = isNaN(totalRefpayable) ? 0 : totalRefpayable;
if (signOnYes) {
//$('#lblreferrerFee').html(currency + ' ').append((totalRefpayable * 0.6).formatMoney(2, '.', ','));
//$('#lbladFeeOnReferrer').html(currency + ' ').append((totalRefpayable * 0.2).formatMoney(2, '.', ','));
//$('#lblcandFeeOnReferrer').html(currency + ' ').append((totalRefpayable * 0.2).formatMoney(2, '.', ','));
//$('#lbltotalFeesOnReferrer').html(currency + ' ').append(totalRefpayable.formatMoney(2, '.', ','));
//totalCanPayable = totalRefpayable * 0.4;
//$('#lblsignonFee').html(currency + ' ').append((totalCanPayable / 2).formatMoney(2, '.', ','));
//$('#lbladFeeOnSignOn').html(currency + ' ').append((totalCanPayable / 2).formatMoney(2, '.', ','));
//$('#lbltotalFeeOnSignOn').html(currency + ' ').append(totalCanPayable.formatMoney(2, '.', ','));
} else {
$('#lblcandFeeOnReferrer').html('-');
$('#lblreferrerFee').html(currency + ' ').append((totalRefpayable).formatMoney(2, '.', ','));
//$('#lbladFeeOnReferrer').html(currency + ' ').append((totalRefpayable * 0.2).formatMoney(2, '.', ','));
//$('#lbltotalFeesOnReferrer').html(currency + ' ').append(totalRefpayable.formatMoney(2, '.', ','));
}
}
Number.prototype.formatMoney = function (c, d, t) {
var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};
function median(values) {
values.sort(function (a, b) { return a - b; });
var half = Math.floor(values.length / 2);
if (values.length % 2)
return values[half];
else
return (values[half - 1] + values[half]) / 2.0;
}
</script>
</asp:Content>
Bashabi, it would appear you are not implementing the ckeditor in the proper way. You have to use an actual ckeditor object to do this. Take a look at this example from the CKEditor forums:
Thanks for your reply. Actually I know that I am missing something here. But I dont know what. The link you gave me is for ckeditor configuration. I dont have any problem with the configuration. the toolbars of ckeditor are visible but the neither the front
end nor backend can recognise the ck editor value.
For example when I write something in the editor and try to submit the form I can't. cause that textarea field is a required field. So the form cannot be submit with that field blank. But actually I have actually written in that field.
If I withdraw the blank field validation then I can submit the form. But it does not save that field data in to database. so when I open that information that field shows blank.
So can you please guide me what I am missing? How can I make it work.
I am new with asp.net and vb.net and looking after another developers code. So please sugest me in easy way.
Member
25 Points
67 Posts
ckeditor value is not recognized by asp.net and vb.net
Jun 10, 2014 11:41 AM|bashabi|LINK
I have integrated ckeditor in my asp.net and vb.net web application. previously This web appilication was using bootstrap-wysihtml5. but now the clients require to use ckeditor.
To integrate ckeditor I have done the following
i am using ckeditor_4.4.1 . I have copied the ckeditor folder in root directory. and linked it in the master page. like the following.
i have not changed the header of the content page. it is like the following
and finally the text area code in the contentpage
The ckeditor toolbar is showing on the textarea.But website can't recognize the value that is written in the ckeditor field nor does it save those value in the database. Even when I submit the form after writting on the text area it is not allowing me to submit form as the description field have to have some text. But I actually wriiten in the textarea or copy paste from wordfile. but it just doesnot gets any value.
Please help me with code
It doesnot has to be ck editor. it can be tinymce or niceedit.
But tinymce and nice edit is not working at all
javascript CKEDITOR asp.net tinymce wysiwig
All-Star
35218 Points
9955 Posts
Moderator
Re: ckeditor value is not recognized by asp.net and vb.net
Jun 10, 2014 11:47 AM|bbcompent1|LINK
Can you please show us the code file? I think you may need to use a different variable to capture text from the ckeditor in your code page.
Member
25 Points
67 Posts
Re: ckeditor value is not recognized by asp.net and vb.net
Jun 10, 2014 12:43 PM|bashabi|LINK
It is a long file. any way i am including it . the required text area has id="txtDescription" name="txtDescription" class="edr" and runat="server"
and the following is the javascript which was included at the bottom of the frontend page.
the backend vb.net is following
All-Star
35218 Points
9955 Posts
Moderator
Re: ckeditor value is not recognized by asp.net and vb.net
Jun 10, 2014 01:00 PM|bbcompent1|LINK
Bashabi, it would appear you are not implementing the ckeditor in the proper way. You have to use an actual ckeditor object to do this. Take a look at this example from the CKEditor forums:
http://ckeditor.com/forums/Support/VB.NET-inline-configuration
Member
25 Points
67 Posts
Re: ckeditor value is not recognized by asp.net and vb.net
Jun 11, 2014 04:59 AM|bashabi|LINK
hi
Thanks for your reply. Actually I know that I am missing something here. But I dont know what. The link you gave me is for ckeditor configuration. I dont have any problem with the configuration. the toolbars of ckeditor are visible but the neither the front end nor backend can recognise the ck editor value.
For example when I write something in the editor and try to submit the form I can't. cause that textarea field is a required field. So the form cannot be submit with that field blank. But actually I have actually written in that field.
If I withdraw the blank field validation then I can submit the form. But it does not save that field data in to database. so when I open that information that field shows blank.
So can you please guide me what I am missing? How can I make it work.
I am new with asp.net and vb.net and looking after another developers code. So please sugest me in easy way.
Regards
Bashabi
All-Star
35218 Points
9955 Posts
Moderator
Re: ckeditor value is not recognized by asp.net and vb.net
Jun 11, 2014 06:25 AM|bbcompent1|LINK
You said it does not have to be ckeditor so have you considered using Rich Text Editor for ASP.NET and MVC? http://richtexteditor.com/
Here is a demo: http://richtexteditor.com/demo/
This one does come with a cost however. For a free alternative, try WinThusiasm HTML Editor: http://winthusiasm.com/
Member
25 Points
67 Posts
Re: ckeditor value is not recognized by asp.net and vb.net
Jun 11, 2014 08:40 AM|bashabi|LINK
I found the answer. And I think I have to share it ; in case someone else faces the same problem.
Here are the steps I followed.
Downloaded the ckeditor from the link http://ckeditor.com/download
Copied the whole folder under project folder.
In the master page added the following lines to add reference of ckeditor
4. Changed the class for the specific textarea
5. Added following javascript function at the bottom of the content page
thats it. No need to change anything in the code file
here the btn.save is the button which submits the data
Thanks