Solved

Boolean Column Datagrid checkbox threestate

Posted on 2004-08-02
10
644 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn on intranet settings 1 57
Printing 1 51
Get distinct values from excel or comm seperated file 4 26
Calculate number of nights between two dates 5 26
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 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