this.gv1.GridElement.VScrollBar.Scroll += new ScrollEventHandler(gv1_VScrollBar_Scroll);
this.gv2.GridElement.VScrollBar.Scroll += new ScrollEventHandler(gv2_VScrollBar_Scroll);
And then I have:
void gv1_VScrollBar_Scroll(object sender, ScrollEventArgs e)
{
gv2.GridElement.VScrollBar.Value = e.NewValue;
}
void gv2_VScrollBar_Scroll(object sender, ScrollEventArgs e)
{
gv1.GridElement.VScrollBar.Value = e.NewValue;
}
Here's the problem. It works for gv1. The event never even fires for gv2. If I comment out the functioning one, the other still doesn't work. Off the top of my head, the only difference I can come up with is that gv2 is heirarchical. Any thoughts?
Thanks,
Dan
6 Answers, 1 is accepted
Thank you for contacting us.
The issue cannot be reproduced in a simple scenario with two RadGridViews, one of them hierarchical.
Consider the code snippet:
public
class
Data
{
public
int
ID {
get
;
set
; }
public
string
Info {
get
;
set
; }
}
public
class
DataRelation
{
public
int
ID {
get
;
set
; }
public
string
Info {
get
;
set
; }
}
private
void
BindGrids()
{
// fill application data
List<Data> data1 =
new
List<Data>();
List<Data> data2 =
new
List<Data>();
List<DataRelation> dataRelation =
new
List<DataRelation>();
FillData(data1);
FillData(data2);
FillDataRelation();
// bind the first grid
radGridView1.DataSource = data1;
// bind the hierarchical grid
radGridView2.DataSource = data2;
GridViewTemplate template =
new
GridViewTemplate();
template.DataSource = dataRelation;
radGridView2.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);
GridViewRelation relation =
new
GridViewRelation(radGridView2.MasterGridViewTemplate);
relation.ChildTemplate = template;
relation.RelationName =
"Relation"
;
relation.ParentColumnNames.Add(
"ID"
);
relation.ChildColumnNames.Add(
"ID"
);
radGridView2.Relations.Add(relation);
// handlers
radGridView1.GridElement.VScrollBar.Scroll +=
new
ScrollEventHandler(radGridView1_VScrollBar_Scroll);
radGridView2.GridElement.VScrollBar.Scroll +=
new
ScrollEventHandler(radGridView2_VScrollBar_Scroll);
}
private
void
radGridView1_VScrollBar_Scroll(
object
sender, ScrollEventArgs e)
{
radGridView2.GridElement.VScrollBar.Value = e.NewValue;
}
private
void
radGridView2_VScrollBar_Scroll(
object
sender, ScrollEventArgs e)
{
radGridView1.GridElement.VScrollBar.Value = e.NewValue;
}
The above scenario works fine. Please provide us with more details for your case or send us a project demonstrating the issue. It will help us define the problem. I am looking forward for your reply.
Regards,
Alexander
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.
Thank you so much for looking into this. I made a few small projects today and untill just now could only verify what you said. It works fine. So back to the original project. I copied the grid with the non-firing event, pasted it back onto the very same form, attached a scroll event, and it worked fine.
Then I began moving lines of code over to the new grid. A difference that I didn't even think to mention was that the problematic grid also had a column group view definition applied. When I changed that line of code to the new grid, the new grid quit working.
First off, my apologies if that is a known issue and my not mentioning it cost you time.
Secondly, here is my code. Have I done it wrong?
private void SetUpColumnGroups()
{
ColumnGroupsViewDefinition colGroups = new ColumnGroupsViewDefinition();
colGroups.ColumnGroups.Add(new GridViewColumnGroup());
colGroups.ColumnGroups.Add(new GridViewColumnGroup("Month"));
colGroups.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
colGroups.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow());
colGroups.ColumnGroups[0].Rows[0].Columns.Add(gv1.Columns["Name"]); colGroups.ColumnGroups[0].Rows[0].Columns.Add(gv1.Columns["Room"]);
colGroups.ColumnGroups[0].Rows[0].Columns.Add(gv1.Columns["Area"]);
colGroups.ColumnGroups[0].Rows[0].Columns.Add(gv1.Columns["WValue"]);
for (int i = 1; i <= 5; i++)
{
colGroups.ColumnGroups[1].Rows[0].Columns.Add(gv1.Columns[string.Format("Week{0}Date", i.ToString())]);
colGroups.ColumnGroups[1].Rows[0].Columns.Add(gv1.Columns[string.Format("Week{0}Code1", i.ToString())]);
colGroups.ColumnGroups[1].Rows[0].Columns.Add(gv1.Columns[string.Format("Week{0}Code2", i.ToString())]);
colGroups.ColumnGroups[1].Rows[0].Columns.Add(gv1.Columns[string.Format("Week{0}Value", i.ToString())]);
}
gv1.ViewDefinition = colGroups; //When I comment out this line, scolling works
gv1.MasterGridViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
Thank you for your time,
Dan
I am sorry but we still cannot reproduce the bug using your SetUpColumnGroups() method and populating the RadGridView with sample data.
It would be best if you can reproduce the issue in a simple project. If not, please send us your project in a new support ticket so we can debug it and find the issue. I am waiting for your response.
Regards,
Alexander
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.
I also faced the same type of issue. And resolved it very easily with the help of your post. Thanks a lot!! It is really helpful and saved my time.
Regards,
Praveena
I am using Telerik winforms 2010 Q3 RadGridView Control.
I am having issue in implementing Vertical scrolling when i use
ColumnGroupsViewDefinition as ViewDefinition.
I tried on the forums also but couldn't find any suitable solution.
My code is:ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
view.ColumnGroups.Add(new GridViewColumnGroup(""));
view.ColumnGroups.Add(new GridViewColumnGroup("Target Category"));
view.ColumnGroups.Add(new GridViewColumnGroup("Source Category"));
view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
view.ColumnGroups[0].Rows[0].Columns.Add(radGridView.Columns["Column1"]);
view.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow());
view.ColumnGroups[1].Rows[0].Columns.Add(radGridView.Columns["Column11"]);
view.ColumnGroups[1].Rows[0].Columns.Add(radGridView.Columns["column12]);
view.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow());
view.ColumnGroups[2].Rows[0].Columns.Add(radGridView.Columns["column21"]);
view.ColumnGroups[2].Rows[0].Columns.Add(radGridView.Columns["column22"]);
this.radGridView.ViewDefinition = view;
When I use ViewDefinition I am not able to get vertical scrolling for the view.
Please let me know how can I achieve this.
Waiting for your reply.
thanks,
Avinash
I am not able to assist you efficiently with the supplied information. I would kindly ask you to open a support ticket where you can attach a sample project that demonstrates your scenario in depth, so we can investigate it and provide you with adequate support.
Greetings,
Svett
the Telerik team