Setting the Binding of GridViewDataColumn throws exception

5 posts, 0 answers
  1. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 26 Jan 2010 Link to this post

    I have a source collection made of a lightweight datatable.

    When I create manually from code behind the columns of the grid, I also bind each one of them to the DataColumn of the DataTable which has the same name.

    The thing is, how come this line :

    GridViewDataColumn col3 = new GridViewDataColumn() { Header = col.ColumnName.ToString().Replace('_', ' '), DataType = typeof(Decimal), DataMemberBinding = new Binding() { Path = new PropertyPath(col.ColumnName)}, CellStyle = this.Resources["gridviewCellStyle"as Style, UniqueName = col.ColumnName, TextAlignment = TextAlignment.Right, IsVisible = col.IsVisible }; 

    throws an exception when col.columnName = "2009" ??
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 26 Jan 2010 Link to this post

    Hello,

    Can you verify if the col.ColumnName does not have any blank space?

    Best wishes,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 26 Jan 2010 Link to this post

    No, there isn't any

    Here's the stacktrace

    Liaison de chemin non valide au caractère 2 de 2009
       à System.Windows.PropertyPathParser.ReadStepDescriptor(Boolean calledFromParser)
       à System.Windows.PropertyPathParser.Parse()
       à System.Windows.PropertyPath.ParsePath(String path, Boolean calledFromParser)
       à System.Windows.PropertyPath.ParsePathInternal(Boolean calledFromParser)
       à System.Windows.Data.Binding.set_Path(PropertyPath value)
       à SilverPartenaire.PartenaireGrille._wsPartenaireClient_GetOngletsContentCompleted(Object sender, GetOngletsContentCompletedEventArgs e)
       à SilverService.ApplicationService.ApplicationServiceClient.OnGetOngletsContentCompleted(Object state)
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 26 Jan 2010 Link to this post

    Hello,

    I've just tried this and I've found that you cannot create Binding in Silverlight with such property name. For example:

    var binding = new System.Windows.Data.Binding("1");

    I've attached small application to illustrate you how to achieve this using custom column.

    Sincerely yours,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 26 Jan 2010 Link to this post

    FYI : It raises the same exception if there are column names containing characters like ° or /
Back to Top
DevCraft banner