Solved

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

Posted on 2013-05-09
2
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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