Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
function chkProjectCode(checkBox) {
if (document.getElementById('<%= hdnCheckedPrevious.ClientID %>').value == "") {
if (checkBox.checked) {
document.getElementById('<%= hdnCheckedPrevious.ClientID %>').value = document.getElementById(checkBox.id.replace('chkInvoices', 'lblProjectCode')).innerHTML;
}
}
JavaScript


else {
if (document.getElementById('<%= hdnCheckedPrevious.ClientID %>').value != document.getElementById(checkBox.id.replace('chkInvoices', 'lblProjectCode')).innerHTML) {
checkBox.checked = false;
alert('Please select Invoices with same Project Code.');
return false;
}
}
}


In above code i am showing alert message 'Please select Invoices with same Project Code.'. now I want to clear all hard coded messages to json format. So which will be better way to use in asp .net.

What I have tried:

In server side i have already done with json format. I am facing problem on the alert message on client side. Please help.
Posted
Updated 18-Aug-16 1:45am
Comments
Karthik_Mahalingam 18-Aug-16 3:06am    
There is no point of using json for this,
only thing is you can optimize the code
F-ES Sitecore 18-Aug-16 4:22am    
JSON format is a way of representing objects as text. I don't understand what you mean by you want alert messages to use JSON? An alert uses a single line of text, it doesn't need or want JSON.

1 solution

Quote:
In server side i have already done with json format.


I'm not sure what exactly is your goal why you would want to display a JSON result in an alert function.

In order for you to get the data from your server. You would need to issue an AJAX request that would spit out a data in form of JSON format: Many ways to communicate with your database using jQuery AJAX and ASP.NET[^]
 
Share this answer
 
Comments
.net bigner 19-Aug-16 2:40am    
Because we don't want to use hard code message inn our application. Main goal is to remove the hard code messages.
Vincent Maverick Durano 19-Aug-16 6:12am    
then you have to follow what I've suggested. To issue an AJAX request to get the dynamic messages from your server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900