Hye,
I am using the RadGrid v2010.2.826.20 and I notice a strange behavior.
The RadGrid works when it is linked on a DataSource by its ID
But when I linked the RadGrid by the DataSource (the object reference ), the Column sorting doesn't work.
Common part
A) The code that works.
B )The code that doesn't work.
I attached handlers on the Selected and Selecting events od the SqlDataSource.
When I click on a column header in order to sort it.
By Method A : Two events are raised :
- Selecting with a correct SortExpression.
- Selected with a correct SortExpression.
By Method B : Four events are raised :
- Selecting with a correct SortExpression.
- Selected with a correct SortExpression.
and then
- Selecting with an empty SortExpression.
- Selected with an empty SortExpression.
I guest do something wrong, but I don't know what.
Any help will be appreciated.
I am using the RadGrid v2010.2.826.20 and I notice a strange behavior.
The RadGrid works when it is linked on a DataSource by its ID
But when I linked the RadGrid by the DataSource (the object reference ), the Column sorting doesn't work.
Common part
<
asp:SqlDataSource
runat
=
"server"
ID
=
"SqlDataSource2"
ConnectionString="<%$ ConnectionStrings:DEV_3.1ConnectionString %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [M9999_Table]">
</
asp:SqlDataSource
>
<
telerik:RadGrid
ID
=
"RadGrid2"
runat
=
"server"
>
<
MasterTableView
AllowSorting
=
"true"
>
</
MasterTableView
>
<
/telerik:RadGrid
>
A) The code that works.
protected
void
Page_Load(
object
sender, EventArgs e)
{
this
.RadGrid2.DataSourceID =
this
.SqlDataSource2.ID;
}
B )The code that doesn't work.
protected
void
Page_Load(
object
sender, EventArgs e)
{
this
.RadGrid2.NeedDataSource +=
new
GridNeedDataSourceEventHandler(RadGrid2_NeedDataSource);
}
void
RadGrid2_NeedDataSource(
object
source, GridNeedDataSourceEventArgs e)
{
this
.LoadData();
}
private
void
LoadData()
{
this
.RadGrid2.DataSource =
this
.SqlDataSource2;
}
I attached handlers on the Selected and Selecting events od the SqlDataSource.
When I click on a column header in order to sort it.
By Method A : Two events are raised :
- Selecting with a correct SortExpression.
- Selected with a correct SortExpression.
By Method B : Four events are raised :
- Selecting with a correct SortExpression.
- Selected with a correct SortExpression.
and then
- Selecting with an empty SortExpression.
- Selected with an empty SortExpression.
I guest do something wrong, but I don't know what.
Any help will be appreciated.