Hi,
I am using NeedDataSource to populate a grid... The following code (shown below) is used in my server control after the radGrid has been created.
I have followed the telerik examples, but had to add the "else" part of this statement as postbacks (eg from buttons unrelated to the grid) caused a blank grid.
Anyway assuming this is valid, I am getting strange behaviour when I sort the grid....
When I click the first column to sort, then click the second column to sort... the third column is actually sorted... If I click the second column again, the second column is then sorted as required...
eg..
My Grid - Unsorted
| Col 1 | Col 2 | Col 3 |
B C A
C A D
A B C
D D B
Now I click Col 1 (All OK):
| Col 1 | Col 2 | Col 3 |
A B C
B C A
C A D
D D B
But now I click Col 2 (But Col 3 sorts !)
| Col 1 | Col 2 | Col 3 |
B C A
D D B
A B C
C A D
Only when I click Col 2 again does Col 2 actually sort correctly...
has anyone come across this issue beofre?
Here is my code
[radGrid1 is created here with all columns etc]
.
.
.
radGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(radGrid1_NeedDataSource);
if (!Page.IsPostBack)
{
// A couple of lines for applying a default filter.
radGrid1.MasterTableView.FilterExpression = "[Variation] = 'Committing'";
GridColumn variationColumn = radGrid1.Columns.FindByUniqueName("Variation");
variationColumn.CurrentFilterFunction = GridKnownFunction.EqualTo;
variationColumn.CurrentFilterValue = "Committing";
radGrid1.DataSource = GetData();
radGrid1.DataBind();
}
else
{
radGrid1.Rebind();
}
.
.
.
void radGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
(sender as RadGrid).DataSource=GetData(); // Returns DataTable
}
Thanks in advance!
I am using NeedDataSource to populate a grid... The following code (shown below) is used in my server control after the radGrid has been created.
I have followed the telerik examples, but had to add the "else" part of this statement as postbacks (eg from buttons unrelated to the grid) caused a blank grid.
Anyway assuming this is valid, I am getting strange behaviour when I sort the grid....
When I click the first column to sort, then click the second column to sort... the third column is actually sorted... If I click the second column again, the second column is then sorted as required...
eg..
My Grid - Unsorted
| Col 1 | Col 2 | Col 3 |
B C A
C A D
A B C
D D B
Now I click Col 1 (All OK):
| Col 1 | Col 2 | Col 3 |
A B C
B C A
C A D
D D B
But now I click Col 2 (But Col 3 sorts !)
| Col 1 | Col 2 | Col 3 |
B C A
D D B
A B C
C A D
Only when I click Col 2 again does Col 2 actually sort correctly...
has anyone come across this issue beofre?
Here is my code
[radGrid1 is created here with all columns etc]
.
.
.
radGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(radGrid1_NeedDataSource);
if (!Page.IsPostBack)
{
// A couple of lines for applying a default filter.
radGrid1.MasterTableView.FilterExpression = "[Variation] = 'Committing'";
GridColumn variationColumn = radGrid1.Columns.FindByUniqueName("Variation");
variationColumn.CurrentFilterFunction = GridKnownFunction.EqualTo;
variationColumn.CurrentFilterValue = "Committing";
radGrid1.DataSource = GetData();
radGrid1.DataBind();
}
else
{
radGrid1.Rebind();
}
.
.
.
void radGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
(sender as RadGrid).DataSource=GetData(); // Returns DataTable
}
Thanks in advance!