A couple Virtual Grid questions
Hello,
I searched for info on these but either got too many results that weren''t actually addressing my (very basic) questions or got no results at all. I''m sure there are threads answering these but I can''t find them. Any direct answers or thread links would be appreciated. Here goes:
1. How would I go about having an AddNew row in my virtual grid? I''m thinking something like:
-> Specify one more row than I have in my DS.
-> return default values or null values for cells in that row when queried.
-> When I get an update to a cell in that row, add a row to my DS and append a row to the grid.
Is this the ''right'' way? Or is there a better way to go about this?
2. How would I go about implementing alternating row background colors? Would I have to update the styleinfo for each row upon query if it''s the row header? I think this would work but it seems like ''the hard way''.
3. How would I set the background color for the current cell upon the cursor entering it? Honestly, I didn''t get to searching for this one, but I''m throwing it in.
Thanks in advance!
I searched for info on these but either got too many results that weren''t actually addressing my (very basic) questions or got no results at all. I''m sure there are threads answering these but I can''t find them. Any direct answers or thread links would be appreciated. Here goes:
1. How would I go about having an AddNew row in my virtual grid? I''m thinking something like:
-> Specify one more row than I have in my DS.
-> return default values or null values for cells in that row when queried.
-> When I get an update to a cell in that row, add a row to my DS and append a row to the grid.
Is this the ''right'' way? Or is there a better way to go about this?
2. How would I go about implementing alternating row background colors? Would I have to update the styleinfo for each row upon query if it''s the row header? I think this would work but it seems like ''the hard way''.
3. How would I set the background color for the current cell upon the cursor entering it? Honestly, I didn''t get to searching for this one, but I''m throwing it in.
Thanks in advance!
SIGN IN To post a reply.
3 Replies
AD
Administrator
Syncfusion Team
July 25, 2006 06:23 AM UTC
Hi Rich,
1. Virtual grid just reflects whatever in your datasource. For adding / removing row, you need to add it in the datasource. Refer to the attached sample that demonstrates to add new row with a help of the BindingManagerBase.
2. In the PrepareViewStyleInfo event handler, add the below code, for having alternating background colors for rows.
3. To have background color for the current cell upon cursor entering, PrepareViewStyleInfo event will help in doing it.
Here is a sample demonstrating the above mentioned features.
Let us know if you need any further assistance.
Regards,
Rajagopal
1. Virtual grid just reflects whatever in your datasource. For adding / removing row, you need to add it in the datasource. Refer to the attached sample that demonstrates to add new row with a help of the BindingManagerBase.
2. In the PrepareViewStyleInfo event handler, add the below code, for having alternating background colors for rows.
if(e.RowIndex > 0 && e.ColIndex > 0 && e.RowIndex % 2 == 1)
e.Style.BackColor = Color.LightBlue;
else
e.Style.BackColor = Color.DodgerBlue;
3. To have background color for the current cell upon cursor entering, PrepareViewStyleInfo event will help in doing it.
GridCurrentCell cc = this.gridControl1.CurrentCell;
if(e.RowIndex == cc.RowIndex && cc.IsEditing)
{
e.Style.BackColor = Color.LightYellow;
}
Here is a sample demonstrating the above mentioned features.
VirtualGridSample.zip
Let us know if you need any further assistance.
Regards,
Rajagopal
AD
Administrator
Syncfusion Team
July 25, 2006 01:44 PM UTC
Thanks Rajagopal,
I will look at your sample and report back what happens.
I will look at your sample and report back what happens.
AD
Administrator
Syncfusion Team
August 10, 2006 04:57 PM UTC
Hi, your suggestions for the alt. colors and backcolor in editing were spot-on (well, there''s some quirkiness with when the cells are color related to the latter but I''ll get back to you when I have a chance to investigate).
I went a different direction with the new row because what I wanted was a AddNew row even before there was any data and I wanted that a new addnew row once the user edited that last row. I got it working, so no worries!
I went a different direction with the new row because what I wanted was a AddNew row even before there was any data and I wanted that a new addnew row once the user edited that last row. I got it working, so no worries!
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
RB Richard Butler
- Jul 24, 2006 10:58 PM UTC
- Aug 10, 2006 04:57 PM UTC