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

[Solved] Filtering Data Yearly

1 Answer 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 01 Aug 2009, 02:32 PM
Hello Sir

In my Radgrid one column contains date , i want to filter out the data yearly means if i enter the year 2008 then it will automatically search the record of year 2008.

and IInd is
In my Radgrid one column contains Cost , it contains the amount 3000.00 format ,, if i enter the value text format then it will give the error .. Is it possible to validate to users enters only Number format data .....


How to achieve this above two functionality ??


How to customize the Date  ? How to seach data yearly ?


Its urgent.....................................

Thanks
Regard
Rahul

1 Answer, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 04 Aug 2009, 03:49 PM

Since I don't know which version of Visual Studio or Telerik Controls you are using I can't guarantee that this will work but I have an idea for each of your problems.

For the first one RadGrid actually has a built in behavior that allows for filtering by columns (not sure how long this behavior has been offered) and it's really easy to implement:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"</telerik:RadGrid> 
 

This should take care of the filtering issue.

For your second issue you could try a simple try catch method. When a user inputs something into a field just take that input and try to set it equal to an int or a long, if successful then the given input is a number, and if it fails give an error message in the catch method. So for example:

userInput; //userInput variable is whatever the user tried to input  
int x;  
try  
{  
   x = userInput 
}  
catch (Exception e)  
{  
   //give the error message here  

I don't know if this is too simple to help you with the issues you were having, but it should be something.
Tags
Grid
Asked by
Rahul
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or