We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridDataBoundGrid CurrentCellChanging event fires irregularly

Hi, It seems that when I change the content of a Dropdown style column or a ColorEdit style column (these are the only two I tested with), first, it fires CurrentCellChanging event twice; the first one has an empty ''ControlText'' property. It fires again immediately and now the ControlText property does have the right value. But then, when I change the contents of the same cell, the event does not fire at all. It only fires again if I change the contents of another cell. I am trying to set the cell value of a ColorEdit control to something like "Color.Yellow" when the user selects the color yellow from the palette. Because, when you select from the palette, it returns the RGB values in numbers and not the name of the color. But if you select from the ''Web'' tab or the ''System'' tab, it returns the name of the color. When I store it to the Cell and the underlying datasource, I want to convert the value consistently either to the color name or the RGB value. Can somebody tell me how to do this please? I hope I explained the whole thing well. Babu.

3 Replies

AD Administrator Syncfusion Team February 14, 2004 10:29 PM UTC

Since not all colors have names, if you want to store teh color as a string, then I think you will probably have to store the r,g,b string containing numbers. Here is a sample that uses CurrentCellCloseDropDown and CurrentCellValidating to manage this. The CurrentCellChanged event does appear to fire twice like you say as the control sets the color empty before its sets it to the chosen color. But I still see the event fired (twice) when I change it a second time. I only see the evnt fired once with the combobox cells. Here is a sample.


BM Babu Mannaravalappil February 15, 2004 04:03 PM UTC

Thanks very much Clay. I will try the sample. Just FYI, I was talking about CurrentCellChanging event and not CurrentCellChanged. I don''t know if that makes any difference because I have not yet tested the CurrentCellChanged event. I wanted to convert the string in the cell before the content is applied on its own. So, I thought the obvious choice would be in the CurrentCellChanging event rather than the CurrentCellChanged event. Thanks again for the prompt help. Babu. >Since not all colors have names, if you want to store teh color as a string, then I think you will probably have to store the r,g,b string containing numbers. Here is a sample that uses CurrentCellCloseDropDown and CurrentCellValidating to manage this. > >The CurrentCellChanged event does appear to fire twice like you say as the control sets the color empty before its sets it to the chosen color. But I still see the event fired (twice) when I change it a second time. I only see the evnt fired once with the combobox cells. > >Here is a sample. > >


BM Babu Mannaravalappil February 15, 2004 04:14 PM UTC

I am sorry I posted the following content as reply to one of my earlier post by mistake. OK. I tried the CurrentCellChanged event and you are right. Though it fires twice, it does fire every time I make changes to the cell even if I am still in the same cell. But the CurrentCellChanging event does not fire if you try the change the value again in the same cell. FYI. Babu.

Loader.
Live Chat Icon For mobile
Up arrow icon