Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 26th, 2004, 05:55 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default binding an tinyint to a CheckBox control...

The Problem is:

I have a Column in my DB and it's a tinyint there's no way to chnage that!
But this tinyint is set througe a DataGrid,
so if ya create a new set of Data u check a CheckBox if it's in or not. And hat's no Problem.
But when I want to update a existing set, i want it to have all stats updatet what it is in DB, but in this problem Colum in DB is jut an int (0 or 1) but the CheckBox wants an Boolean....

any ideas how to solve that???


That's the way i already tryd it.
But The Problem here is, When it comes to DataBind Method it says It couldn't be done!

code snippet:

aspx



<EditItemTemplate>
    <asp:CheckBox ID="chkResendEdit" Checked='<# FormatBooleanFromInt((string)DataBinder.Eval(Conta iner.DataItem, "ResendErrSMS")) %>' Text="Resend" Runat="server" />
</EditItemTemplate>



code behind



        public Boolean FormatBooleanFromInt(string svalue)
        {
            if (svalue == "0")
            {
                return false;
            }
            else
            {
                return true;
            }
        }





Similar Threads
Thread Thread Starter Forum Replies Last Post
binding a checkbox ?? msordo VB.NET 2002/2003 Basics 0 April 9th, 2008 05:35 PM
Out of range values stored in tinyint column BorisG SQL Server 2005 7 July 14th, 2007 12:34 PM
CheckBox binding in ListView - Multiple events! dweezilb Windows Presentation Foundation 1 April 22nd, 2007 06:39 PM
Binding a checkbox that contain Y/N values aad1 C# 1 May 17th, 2006 07:23 PM
binding a constituent control to property ParadiseIsle Beginning VB 6 1 November 11th, 2005 02:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.