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

[Solved] Filtering not working with field backed with securestring

1 Answer 28 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nijanand
Top achievements
Rank 1
Nijanand asked on 28 Jun 2012, 05:37 PM
I have a field A of type securestring in my Model, i expose a string property for the securestring, converting it to a string, for grid binding.

Sorting on column B works, but when i use filters, it throws an InvalidCastException ( Invalid cast from 'System.String' to 'System.Security.SecureString'.)
      
  public SecureString A;
  
public string B{
      
get { return A.ConvertToUnsecureString();
           }  //We have a public getter to ensure grid Telerik binding works
       
set { A = value.ConvertToSecureString();
            }
}


columns.Bound(o => o.B)

1 Answer, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 1
answered on 29 Jun 2012, 01:42 PM
Nijanand,

The problem you are experience is happening because the control is attempting to model bind to the public SecureString backing field "A".

Simply change it's access modifier to private and the exception will go away :-)
Tags
Grid
Asked by
Nijanand
Top achievements
Rank 1
Answers by
Joe
Top achievements
Rank 1
Share this question
or