Hello everyone
I have a Telerik RadGrid on a page that uses an asp ObjectDataSource. This is a search page, and the user selects some options from drop down lists etc and then clicks a Search button. The ObjectDataSource uses a SelectMethod to retrieve the data from the database based on the parameters. I have set a breakpoint here and the ObjectDataSource returns the correct dataset. However the grid does not update. I have set AllowPaging = true, and if I change the page size, the grid updates with the correct data.
Many thanks for your help
Grid
DataSource
DataSource SelectMethod
I have a Telerik RadGrid on a page that uses an asp ObjectDataSource. This is a search page, and the user selects some options from drop down lists etc and then clicks a Search button. The ObjectDataSource uses a SelectMethod to retrieve the data from the database based on the parameters. I have set a breakpoint here and the ObjectDataSource returns the correct dataset. However the grid does not update. I have set AllowPaging = true, and if I change the page size, the grid updates with the correct data.
Many thanks for your help
Grid
<
telerik:RadGrid
ID
=
"alarms"
runat
=
"server"
CssClass
=
"gridview"
AllowAutomaticUpdates
=
"true"
AutoGenerateColumns
=
"false"
OnItemDataBound
=
"AlarmDataBound"
AllowPaging
=
"true"
AllowSorting
=
"true"
AllowMultiRowSelection
=
"true"
PagerStyle-Mode
=
"NextPrevAndNumeric"
PagerStyle-AlwaysVisible
=
"true"
>
<
MasterTableView
>
<
Columns
>
<
Columns
removed>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
SelectedItemStyle
CssClass
=
"selected"
/>
<
AlternatingItemStyle
CssClass
=
"even"
/>
</
telerik:RadGrid
>
DataSource
<
asp:ObjectDataSource
ID
=
"alarmData"
runat
=
"server"
SelectMethod
=
"GetAlarmData"
TypeName
=
"******.AlarmManagement"
>
</
asp:ObjectDataSource
>
DataSource SelectMethod
public DataSet GetAlarmData(string dummy)
{
using (SqlConnection connection = new SqlConnection(connString.ConnectionString))
{
try
{
connection.Open();
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
// Get the data based on search criteria
da.Fill(ds);
return ds;
}
catch (SqlException ex)
{
// Log the error
return null;
}
finally
{
connection.Close();
}
}
}