?
Solved

Boolean Column Datagrid checkbox threestate

Posted on 2004-08-02
10
Medium Priority
?
677 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

764 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