Solved

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

Posted on 2013-05-09
2
364 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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