473,396 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

what is the proper to bind checkbox

GS
I tried to represent windows form checkbox as int 1 for checked otherwise 0
and bind as checkstate. That did not work. should I bind to text or
whatever, or I should use something other than Int in the sql database?

I tried Google so far no luck, built-in help no luck except possibly some
thing for web.ui
Nov 3 '07 #1
2 6315
You should bind to the field to the Checked property. You should also
cast the return value from the database to a boolean, not an integer.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"GS" <gs**********************@msnews.Nomail.comwrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...
>I tried to represent windows form checkbox as int 1 for checked otherwise 0
and bind as checkstate. That did not work. should I bind to text or
whatever, or I should use something other than Int in the sql database?

I tried Google so far no luck, built-in help no luck except possibly some
thing for web.ui

Nov 4 '07 #2
GS
thank you very much. Glad to see it working.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:B3**********************************@microsof t.com...
You should bind to the field to the Checked property. You should also
cast the return value from the database to a boolean, not an integer.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"GS" <gs**********************@msnews.Nomail.comwrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...
I tried to represent windows form checkbox as int 1 for checked otherwise
0
and bind as checkstate. That did not work. should I bind to text or
whatever, or I should use something other than Int in the sql database?

I tried Google so far no luck, built-in help no luck except possibly
some
thing for web.ui

Nov 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Francois | last post by:
Hi, First of all sorry for the long post but I believe it is quite an interesting as well as advanced and complex problem. I have a problem with the checkbox control I have in my repeater. I...
1
by: Alan Silver | last post by:
Hello, I have a page in which I'm trying to give the user the chance to manipulate a list of items. These are the price variations for a product, so each item consists of a name (eg, small,...
4
by: Woody Splawn | last post by:
What is the easiest way to do this. I have a field in a Winform where I want either and only a Y or an N (or perhaps a null). One way is to use a combobox with a drop down list. Is there...
6
by: jaYPee | last post by:
I have bind textboxes in my form successfully using the databindings > text property. but don't know how to bind checkbox. i set the checkbox databindings > text property the same with textbox but...
11
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, Byte imageData = (Byte)(((DataRowView)fvEmployeeMaster.DataItem).Row.ItemArray.GetValue(21)); If the record coming in is null i get the following error message: Unable to cast...
2
by: sfxx | last post by:
In my windows form, I bind the 'checked' property of a checkbox to a column (data type = bit). It works when I try to update the data source using this databinding. BUT the problem is : when I try...
0
by: yogarajan | last post by:
hi all i need proper alignment my treeview looks like <checkbox>Fruits(parent)-134 <checkbox>Mango(child)-45 <checkbox>Orange(child)-45 ...
3
by: forum.microsoft.com | last post by:
I am trying to bind windows form checkbox in Sql and bind the checkbox to sql. I tried representing checkstate as integer 1 for true otherwise integer 0. That does not work. I tried binding to...
1
by: dhamo | last post by:
How to bind checkbox with gridview in asp.net 2.0 I take a gridview control and bind data dynamicaly using code.I taken backend tool as a Ms Access and now I want to add new column with checkbox...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.