[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Boolean Column Datagrid checkbox threestate

Posted on 2004-08-02
10
Medium Priority
?
687 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

656 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