Hi
I am trying to use a rad grid with a linqdatasource, but because we are using webapi calls we cannot directly bind to the database. The filter does not work correctly and the datetime picker does not remember the value after the postback occurs.
Here is the ASP:
And the codebehind:
Thanks
I am trying to use a rad grid with a linqdatasource, but because we are using webapi calls we cannot directly bind to the database. The filter does not work correctly and the datetime picker does not remember the value after the postback occurs.
Here is the ASP:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPag="True" DataSourceID="LinqDataSource1" GroupPanelPosition="Top"> <MasterTableView AutoGenerateColumns="False" DataKeyNames="TaskID" DataSourceID="LinqDataSource1"> <Columns> <telerik:GridDateTimeColumn DataField="DateCreated" DataType="System.DateTime" EnableTimeIndependentFiltering="true" FilterControlAltText="Filter DateCreated column" HeaderText="DateCreated" SortExpression="DateCreated" UniqueName="DateCreated" ShowFilterIcon="false" AutoPostBackOnFilter="true"> <ColumnValidationSettings> <ModelErrorMessage Text="" /> </ColumnValidationSettings> </telerik:GridDateTimeColumn> </Columns> </MasterTableView> </telerik:RadGrid> <asp:LinqDataSource ID="LinqDataSource1" OnSelect ing="LinqDataSource1_Selecting" runat="server"> </asp:LinqDataSource>And the codebehind:
public partial class Test : System.Web.UI.Page { private WebAPICalls MyWebAPi = new WebAPICalls(); protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) { var tasks = MyWebAPi.GetDataTable("GetAllTasks"); //Doing this otherwise it complains about not finding the TaskID property var results = from rows in tasks.AsEnumerable() select rows; e.Result = results; } protected void Page_Load(object sender, EventArgs e) { } }Thanks