Problems in changing row''s background color within gridcontrol
Hi, everyone
I have little problem in changing the background of rows in grid control. At the beginning I looped through the grid's rows and did ->
If t Mod 2 = 0 Then grdNew.RowStyles(t).BackColor = Yellow
Else grdNew.RowStyles(t).BackColor = White End If
then I tried to loop:
If t Mod 2 = 0 Then grdNew.RowStyles(t).BackColor = Purple
Else grdNew.RowStyles(t).BackColor = Orange End If
and nothing happened (rows remained yello and white).
Please let me know if there anything I can do about it.
Thanks in advance and have a nice day :)
Allon
I have little problem in changing the background of rows in grid control. At the beginning I looped through the grid's rows and did ->
If t Mod 2 = 0 Then grdNew.RowStyles(t).BackColor = Yellow
Else grdNew.RowStyles(t).BackColor = White End If
then I tried to loop:
If t Mod 2 = 0 Then grdNew.RowStyles(t).BackColor = Purple
Else grdNew.RowStyles(t).BackColor = Orange End If
and nothing happened (rows remained yello and white).
Please let me know if there anything I can do about it.
Thanks in advance and have a nice day :)
Allon
SIGN IN To post a reply.
8 Replies
RC
Rajadurai C
Syncfusion Team
October 13, 2009 02:21 PM UTC
Hi Allon,
Thanks for your interest in Syncfusion Products.
The provided code works fine in our side. Can you please provide details about the version you are using and code settings if any, handled alongwith in your application. It would be fine for us to see the issue and work to provide a solution for it.
Regards,
Rajadurai
Thanks for your interest in Syncfusion Products.
The provided code works fine in our side. Can you please provide details about the version you are using and code settings if any, handled alongwith in your application. It would be fine for us to see the issue and work to provide a solution for it.
Regards,
Rajadurai
AL
Allon
October 13, 2009 02:40 PM UTC
Hello again
I use:
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP2
Installed Edition: Professional
Essential Studio 7.3.0.20 (Ver number of Syncfusion).
Hopping it will help in something.
Regards,
Allon
I use:
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP2
Installed Edition: Professional
Essential Studio 7.3.0.20 (Ver number of Syncfusion).
Hopping it will help in something.
Regards,
Allon
AL
Allon
October 14, 2009 09:36 AM UTC
If it'd help you to explain and solve my problem, I suggest you to send me a little app (with environment similar to mine) with the right solution.
Have a nice day :)
Allon
Have a nice day :)
Allon
RC
Rajadurai C
Syncfusion Team
October 14, 2009 02:18 PM UTC
Hi Allon,
Thanks for your details.
Herewith i have attached a sample for your reference with the code you provided .
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F90669.zip
In this sample, the first code snippet is handled in Form() constructor and second code snippet is handled in button click event in order to see the difference in grid while applying color settings.
Regards,
Rajadurai
Thanks for your details.
Herewith i have attached a sample for your reference with the code you provided .
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F90669.zip
In this sample, the first code snippet is handled in Form() constructor and second code snippet is handled in button click event in order to see the difference in grid while applying color settings.
Regards,
Rajadurai
AL
Allon
October 15, 2009 07:18 AM UTC
Thanks, but the link does not work.
I think that my problem was that I wrote:
Private Sub grdNew_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles grdNew.PrepareViewStyleInfo
If e.RowIndex > 0 And e.ColIndex > 0 Then
If e.RowIndex Mod 2 = 0 Then
e.Style.BackColor = myColors.AlternateColor
End If
End If
End Sub
and I couldn't rid of it.
Regards,
Allon
I think that my problem was that I wrote:
Private Sub grdNew_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles grdNew.PrepareViewStyleInfo
If e.RowIndex > 0 And e.ColIndex > 0 Then
If e.RowIndex Mod 2 = 0 Then
e.Style.BackColor = myColors.AlternateColor
End If
End If
End Sub
and I couldn't rid of it.
Regards,
Allon
RC
Rajadurai C
Syncfusion Team
October 15, 2009 11:50 AM UTC
Hi Allon,
Thanks for your update.
The link provided in my previous update works fine. Regarding the issue with backcolor, if you are setting backcolor for certain rows in grid through PrepareViewStyleInfo event, then you cannot overwrite those cells with other colors through some other means. The PrepareViewStyleInfo event get triggered each time the style setting of a cell is queried.
One thing you can try to achieve setting different color at runtime is, supply the colors through custom properties and set them in PrepareViewStyleInfo event.
Please refer to the following sample in which this has been achieved. By clicking the button, you can apply different set of colors.
F90669.zip
Regards,
Rajadurai
Thanks for your update.
The link provided in my previous update works fine. Regarding the issue with backcolor, if you are setting backcolor for certain rows in grid through PrepareViewStyleInfo event, then you cannot overwrite those cells with other colors through some other means. The PrepareViewStyleInfo event get triggered each time the style setting of a cell is queried.
One thing you can try to achieve setting different color at runtime is, supply the colors through custom properties and set them in PrepareViewStyleInfo event.
Please refer to the following sample in which this has been achieved. By clicking the button, you can apply different set of colors.
F90669.zip
Regards,
Rajadurai
AL
Allon
October 15, 2009 01:38 PM UTC
Hi, Rajadurai
Thanks a lot for your quick and efficient reply. That was really helpful.
Have a nice day :)
Allon
Thanks a lot for your quick and efficient reply. That was really helpful.
Have a nice day :)
Allon
RC
Rajadurai C
Syncfusion Team
October 15, 2009 01:39 PM UTC
Hi Allon,
Thanks for your update.
Regards,
Rajadurai
Thanks for your update.
Regards,
Rajadurai
SIGN IN To post a reply.
- 8 Replies
- 2 Participants
-
AL Allon
- Oct 13, 2009 07:54 AM UTC
- Oct 15, 2009 01:39 PM UTC