This is a migrated thread and some comments may be shown as answers.

RadGridView CheckBoxEditor

5 Answers 361 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Garry
Top achievements
Rank 1
Garry asked on 11 Dec 2007, 07:45 AM
Hi,

I am having a very frustrating time getting to grips with RadGridView. I was hoping someone could help with the following;

I have a RadGridView with a checkbox in the right most column. I have the following code in the cellclick event;
GridCheckBoxCellElement cell = (GridCheckBoxCellElement)sender;  
 
RadCheckBoxEditor editor = (RadCheckBoxEditor)cell.Children[0];  
 
editor.SaveValue();  
 

 On inspecting the 'editor.value', as expected it either returns true or false depending on the checkbox checked state, however when the editor.SaveValue(); is called I receive an 'Object reference not set to an instance of an object.' error. I want the underlying Data to be immediatley updated as soon as a checkbox is clicked. Has anyone got any ideas?

Thanks!

George


5 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 11 Dec 2007, 06:02 PM
Hello Stylli,

You are on the right track - your code is accurate except that it should be executed in the ValueChanged event. I have tested this scenario and it works as you need it to. It saves the value immediately after the checkbox cell is clicked.

If you need further assistance, please do not hesitate to write us again.

 
Sincerely yours,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Garry
Top achievements
Rank 1
answered on 12 Dec 2007, 09:07 AM
Hi Georgi,

Thank you for your reply. Unfortunately I can still not get this to work.
I have tried, as you suggested to move the code the ValueChanged event although this event does not fire when I click the checkbox, it only fires when I change rows or press enter.

Here is the code I used.
private void radGridView1_ValueChanged(object sender, EventArgs e)  
{  
if (sender is GridCheckBoxCellElement)  
{  
GridCheckBoxCellElement cell = (GridCheckBoxCellElement)sender;  
RadCheckBoxEditor editor = (RadCheckBoxEditor)cell.Children[0];  
editor.SaveValue();  
}  
}  
 

It would be very, very useful if you had an example snippet of code to show.

Thanks again.

Regards



0
Georgi
Telerik team
answered on 14 Dec 2007, 05:57 PM
Hello Stylli,

Obviously, there is a difference between your project and my test application. I am attaching my working project so you could review its implementation. If your need further assistance, please write us again and we will do our best to help you.
 

Greetings,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sowjanya MV
Top achievements
Rank 1
answered on 25 Feb 2010, 05:11 AM

Hi,

we are using checkboxeditor in our project.
we are  adding  some text to checkboxeditor.
The background color of Checkboxeditor we are getting is orange.
When we change the back ground color of check box . Only the border of checkbox is getting changed.
 I want to change the back ground of text as well which is given to check box.....
Please reply me with a solution to solve this problem

0
Martin Vasilev
Telerik team
answered on 26 Feb 2010, 03:00 PM
Hi Sowjanya MV,

Thank you for writing. Because RadGridView for Winforms does not support text in a grid check box editor out of the box, please send me more details how exactly you customized it. This will help me understand your scenario better and provide accurate assistance. I look forward to your reply.  

All the best,
Martin Vasilev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Garry
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Garry
Top achievements
Rank 1
Sowjanya MV
Top achievements
Rank 1
Martin Vasilev
Telerik team
Share this question
or