Solved

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

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

Suggested Solutions

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now