Solved

Boolean Column Datagrid checkbox threestate

Posted on 2004-08-02
10
638 Views
Last Modified: 2008-01-09
I have a C# form with a datagrid and in that i have used TableStyles and DataGridColumn styles. My problem is with a Boolean column. A checkbox appears in the column but when clicked it goes as grayed out just after being checked. i.e. on clicking it must toggle as checked-unchecked-checked..........................  but it is going as checked-grayed-unchecked-checked-grayed-unchecked. I want to remove the grayed out condition so that on each click it just toggles between check and uncheck and is never grayed out. I have already set the AllowNull property of TableStyle to false but still cant get it done. Please help!!!!
Prashant
0
Comment
Question by:prashantagarw10
10 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11699260
http://www.syncfusion.com/forums/message.asp?MessageID=1450 i didnt know the second part .. thanks for teaching me something :)
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 11701044
Set the AllowNull property of the Column Style to false (you said you already did that). This should immediately disallow the three states if the column in the underlying datasource is of a boolean type. Only in the beginning, when a new row is created, it will still show with gray. To remove this, in your data table which is the data source for the data grid, you need to set a default value to either true or false. This will solve the initial value problem as well.
0
 
LVL 1

Expert Comment

by:janeburton
ID: 11704020
under style, there's a selectedItemStyle, make sure u didn't set any color properties there.
0
 
LVL 5

Author Comment

by:prashantagarw10
ID: 11704682
I see your solutions. But just now i found something real amazing. When i bind the same DataGrid to another datatable in same dataset then the problem disappears. The dataset has been built from a XML file with 2 tables in it. The one i am using is the child table and just to test i used the parent table and then it did not show any gray state in checkbox so i guess something to do in datatable. Can nay of u think on that line ? I have already tried setting Datatable columns to AllowDBNull=False and also given a default value to each such boolean column. Also i have checked the values in run mode and found no nulls at all. No rows can be added or deleted from any datatable, they can only be modified. and i did check to not set any colors in any property and it just comes when toggling the checkbox. Think guys!!!!!!!
Prashant
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 20

Expert Comment

by:TheAvenger
ID: 11704713
You need to set the default value in the dataset. Select the column and search for the default value property. This is the value for new rows, so you cannot see it in existing rows
0
 
LVL 5

Author Comment

by:prashantagarw10
ID: 11706692
I have set the default value in dataset too. But no luck my friend. Just cant do it. I also tried more combinations and found that whenever i bound any grid to this datatable then the grayed checkbox appears except for when i bind it to datagrid which is currently being used by the other datatable in the same dataset.
0
 
LVL 5

Author Comment

by:prashantagarw10
ID: 11708892
Hi guys
I have myself found the solution. I had actually done some code to remove a few columns from the dataset while it was used for generating TableStyles and GridColumnStyles. the columns were not required in the datagrid so i had removed them. now i just made them invisible by seeting their width to 0 so now all works fine.
but thanks for all your help.
Prashant
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11981808
PAQed, with points refunded (250)

Netminder
Site Admin
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

19 Experts available now in Live!

Get 1:1 Help Now