This is a migrated thread and some comments may be shown as answers.

gridboundcolumn type field validation

2 Answers 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 28 Jul 2015, 03:04 PM

In my web app I have a radgrid binded to a EF dbcontext collection.

 Issue is that gridboundcolumn don't check for datatype on  applying filters and entity query is wrong, for example, If user enters 'some text' on a date filter query is raised as:

 "AND (it.lastEditDate = DATETIME'some text')"

and web app crash with "The query syntax is not valid. Near term 'some text', line 6, column 28." The same problem with numeric fields.

What is the right solution for this issue? Thanks!

 Code looks like this:

<telerik:RadGrid ID="RadGrid1" 
    runat="server" 
    CellSpacing="0" 
    DataSourceID="edsMainGrid"
....
<telerik:GridBoundColumn FilterControlWidth="50px" ItemStyle-Wrap="false"  DataField="lastEditDate"
   FilterControlAltText="Filtrar per lastEditDate" HeaderText="lastEditDate" SortExpression="lastEditDate" UniqueName="lastEditDate" ReadOnly="True" DataFormatString="{0:dd/MM/yyyy}">
   <ItemStyle Width="50px" />
</telerik:GridBoundColumn>
...


<ef:EntityDataSource ID="edsMainGrid" runat="server" 
   OnContextCreating="edsMainGrid_ContextCreating"
   EntitySetName="myCollection"
   OnSelecting="edsMainGrid_Selecting" >
</ef:EntityDataSource>

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 31 Jul 2015, 10:12 AM
Hi Daniel,

In this case instead of using GridBoundColumns I would suggest you to use GridDateTimeColumn and GridNumeric column which will generate respectively RadDatePicker and RadNumericTextBox in the filter items.
I hope this helps.

Regards,
Maria Ilieva
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Daniel
Top achievements
Rank 1
answered on 17 Oct 2015, 08:23 AM
Thanks Maria, like a charm.
Tags
General Discussions
Asked by
Daniel
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or