Home
|
Forums
|
Contact
|
Search
|
Syndication
[login]
[create account]
Saturday, February 22, 2025
slxdeveloper.com
Home
Search
Contact us
About slxdeveloper
Syndication
Community
Forums
(NEW!)
Newsletter Archive
Members
Your Profile
Submit Article
General
Administration
(6)
OLE DB Provider
Miscellaneous
(2)
Architect
VBScript
(9)
ActiveX Controls
(6)
How To's
(14)
.NET Extensions
(3)
External
OLE DB Provider
(12)
SLAPI (SlgxApi.dll)
SalesLogix COM
(1)
Web
ASP/ASP.NET
(2)
Web Services
Web Client
Downloads
Samples
(17)
Documentation
(7)
Utilities
(18)
Resources
SalesLogix
(3)
Programming
(1)
2/22/2025 4:01:33 PM
slxdeveloper.com Community Forums
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (
For version 7.2 and higher only
). View the
code of conduct
for posting guidelines.
Forums RSS Feed
Back to Forum List
|
Back to SalesLogix Web Platform & Application Architect
|
New Thread
View:
Dynamic
Flat
Tree
Search:
Author
Thread: 'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Steve Knowles
Posts: 657
'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Posted: 03 Apr 08 7:47 PM
In VS I have a smartpart with a checkbox control. When checked a panel is toggled on or off and some other code is fired. I had the checkbox mapped to the .Checked property. That was causing an error in some code in the checkbox's _CheckChanged event. So I mapped the checkbox to the .Text property. That stopped the error, but then the checkbox data doesn't save..
The error I am getting in the SLX web client is ('StringConverter' is unable to convert 'System.String' to 'System.Boolean'). It's strange because the databinding (checkbox1.Checked vs checkbox1.Text) seems to affect the error, but the error is happening just after the _CheckChanged event. Perhaps because of postback.. When I debug in VS it seems to run the code in the _CheckChanged event fine, then calls a sub in ticket.cs (the smartpart is based on a custom extension entity off Ticket). then the error occurs in system generated code in the calling .aspx page. It is failing on the code with the >>>>(arrows) next to it:
function hideRequestIndicator(sender, args) {
var elem = document.getElementById("asyncpostbackindicator");
if (elem) { elem.style.visibility = "hidden"; }
if (args.get_error() != undefined)
{
var errorMessage;
>>>>> if (args.get_response().get_statusCode() == '200')
{
errorMessage = args.get_error().message;
}
else
{
Any thoughts?
[
Reply
][
Quote
]
Bob (RJ)Ledger
Posts: 1103
Re: 'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Posted: 06 Apr 08 8:33 AM
Every time I get this error it's because I did not "initialize" the boolean db field to 'F'/False.
I suggest you build a simple business rule at the entity level on the boolead field/property to set it false when you create a new record.
EX: I added some fields to teh Address table.. so using the OnCreate (added POST Execute step) "event":
namespace Sage.BusinessRules.CodeSnippets
{
public static partial class AddressBusinessRules
{
public static void OnCreateStep1( IAddress address)
{
// TODO: Complete business rule implementation
address.IsFinancial = false;
address.IsGiving = false;
address.IsInvitation = false;
address.IsSolicitation = false;
}
}
}
This is EXACTLY what the SalesLogix dev team is doing to avoid this same problem.
Nulls are killing us!
--
RJLedger - rjlSystems
[
Reply
][
Quote
]
Steve Knowles
Posts: 657
Re: 'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Posted: 14 Apr 08 9:12 AM
I also had to go into the entity model/properites for each field (double click and it appears in the middle pane) and change from "Text" to TrueFalse. This cured by problem.
[
Reply
][
Quote
]
Ryan Farley
Posts: 2265
Re: 'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Posted: 14 Apr 08 6:25 PM
Quote:
Originally posted by Steve Knowles
I also had to go into the entity model/properites for each field (double click and it appears in the middle pane) and change from "Text" to TrueFalse. This cured by problem.
Sorry for not chiming in on this sooner (I was in Hawaii
). I've seen this quite often where "SLX Boolean" properties get brought in as String properties instead of TrueFalse properties. Then, if you bind them to a checkbox you'll get the exact error you mention since you've bound a String property to a Boolean property of a control. The solution is to do just what you've done, change the properties on the entity from String to TrueFalse properties and rebuild (and deploy) then all is well. No need to initialize the booleans as anything.
-Ryan
[
Reply
][
Quote
]
sreenivas
Posts: 14
Re: 'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Posted: 14 Apr 08 9:10 PM
I am unable to understand where is the problem. Is it in Applicaition Architect (AA) or Saving data to database using custom page via VS.
Actually, if you are using smartpart from AA, then you need to explicitly set the datatype. For that, double click on the entity, view all the fields (properties) your entity (fields imported from Table) have. Go to the field where you are saving the check box value (example: ValueSelect char(1)), then change the database to "TrueFalse". This will allow slx smartpart to save the value of checkbox to your database as T or F.
If you are facing any databinding using grid view issues for checkbox use Checked='<%# (Convert.ToBoolean(Eval("CHECKED")))%>'
Modified sql query to get true or false. But, our windows developers were stored checked and uncheck as 1 and 0.
"SELECT CASE WHEN A2.CHECKED=1 THEN 'True' ELSE 'False' END AS CHECKED, A1.PROCESS_MASTERID, A1.PROCESS_NAME, A2.COMMENTS, A2.ContactID, A2.QUALIFICATION_DETAILSID ";
I faced few problems using checkbox. After spending almost 3 to 4 hrs with many option, I found a solution.
[
Reply
][
Quote
]
sreenivas
Posts: 14
Re: 'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Posted: 14 Apr 08 9:12 PM
Checked='<%# (Convert.ToBoolean(Eval("CHECKED")))%>'
For some reason, percentage symbo is not appearing. Repalalce percentage and hash by its symbol.
Checked='
'
[
Reply
][
Quote
]
sreenivas
Posts: 14
Re: 'StringConverter' is unable to convert 'System.String' to 'System.Boolean'
Posted: 14 Apr 08 9:14 PM
Convert.ToBoolean(Eval("CHECKED"))
Checked='GretersignPercentageHashConvert.ToBoolean(Eval("CHECKED"))PercentageLessersign'
[
Reply
][
Quote
]
Page 1 of 1
You can subscribe to receive a daily forum digest in your
user profile
. View the site
code of conduct
for posting guidelines.
Forum RSS Feed
-
Subscribe to the forum RSS feed to keep on top of the latest forum activity!
slxdeveloper.com is brought to you courtesy of
Ryan Farley
&
Customer FX Corporation
.
This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.
code of conduct
|
page cache (param): 2/22/2025 4:16:07 PM