CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Display Checkbox value from another table on a Grid

Print topic Send  topic

Author Message
kescott


Posts: 49
Posted: 11/20/2008, 2:10 PM

I'm trying to display the checkbox value from another database table to Grid:Vendors by using this code:

//Get Control  
System.Web.UI.WebControls.CheckBox VendorsCheckBox1 =  
(System.Web.UI.WebControls.CheckBox)  
(e.Item.FindControl("VendorsCheckBox1"));

//Retireve value from other database table
  
VendorsCheckBox1.Checked = (new CheckBox  
("",Settings.identification_DEVELOPMENTDataAccessObject  
.ExecuteScalar("SELECT <booleanColumn> FROM <differentTable>"))).Checked("");  

Got an ideas?
_________________
B.S. of Computer Science
Class of 2005
Norfolk State University
Norfolk, VA
http://www.nsu.edu
View profile  Send private message
kescott


Posts: 49
Posted: 11/24/2008, 8:35 AM

I believe I solved this issue with the following code:

First of all for checkbox I set Data Type to Boolean
(I assume that custom sql returns a value of boolean type field).

And you need to create not a new "Checkbox" but new "BooleanField" instance:
VendorsCheckBox1.Checked = (new BooleanField...

Then apply ParseBool method of DBUtility to convert String value returned by the code to Boolean value:
VendorsCheckBox1.Checked =DBUtility.ParseBool((new BooleanField... ,"")

So in common the should looks like:
  
<form_name><checkbox_name>.Checked = DBUtility.ParseBool  
((new BooleanField("",Settings.DatabaseConnectionName>  
DataAccessObject.ExecuteScalar  
("Custom SQL"))).GetFormattedValue(""),"");  


Anyone know if this is correct?
O:)
_________________
B.S. of Computer Science
Class of 2005
Norfolk State University
Norfolk, VA
http://www.nsu.edu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.