Solved

Who to convert a look up field to a boolean field dynamically using C#

Posted on 2013-05-09
2
365 Views
Last Modified: 2013-05-10
I have an application that has a checkbox on the app. When the user checks the checkbox the name of the person in the lookup field on another form needs to be inserted on an ssrs report. I need to know who to accomplish this. I get an error message with the code that I have now.
Error Message:
String was not recognized as a valid Boolean.

Code below:
Line 185:                        chkSEWP.Checked = Convert.ToBoolean(rpt_submittedtosewp);
Line 186:                        SEWPDateTxt.Text = rpt_sewpdate;
Line 187:                        chkShowServiceSupportRep.Checked = Convert.ToBoolean(rpt_servicesupportrep);

 
Please help. Thank you

Open in new window

0
Comment
Question by:newjeep19
2 Comments
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 500 total points
ID: 39154247
The value could be "".

chkSEWP.Checked = Convert.ToBoolean(rpt_submittedtosewp); should be changed as below.


chkSEWP.Checked =  rpt_submittedtosewp.toLower() == "true" ? true:  ( rpt_submittedtosewp == ""  ? false : true)

Open in new window



Likewise change your third statement as well.
0
 

Author Closing Comment

by:newjeep19
ID: 39155793
Very excellent....thank you very much!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question