How to set the converter in the code-behind in silverllight

2 posts, 0 answers
  1. kavitha
    kavitha avatar
    10 posts
    Member since:
    Jun 2011

    Posted 04 Jan 2014 Link to this post

    I am using converters in code behind.I have follwed below link :

    From Telerik Link :  http://www.telerik.com/community/forums/silverlight/gridview/codebehind-binding-with-converter-in-c.aspx 

    Like :

    GridViewDataColumn column = new GridViewDataColumn();

    column.DataMemberBinding = new Binding("Notes") { Converter = new RichTextFormat() };

    VReportViewer.GrdReport.Columns.Add(column);
    It is adding as a new column to the grid and data showing correctly.

    But problem is...it is adding as new column to RadGridview.

    I have to assign this converts ..that is already existed columm.

    like : ((GridViewDataColumn)VReportViewer.GrdReport.Columns["Notes"]).DataMemberBinding = new Binding() { Converter = new RichTextFormat()};

    if i use aboue line : i am getting error :

    illegal xml character [Line: 1 Position: 2]

    Let me know how can i use this converts in code bedhind.


    I am using converters in code behind.

    I have follwed below link :

    From Telerik forum

    Like :

    GridViewDataColumn column = new GridViewDataColumn();

    column.DataMemberBinding = new Binding("Notes") { Converter = new RichTextFormat() };

    VReportViewer.GrdReport.Columns.Add(column);

    It is adding as a new column to the grid and data showing correctly.

    But problem is...it is adding as new column to RadGridview.

    I have to assign this converts ..that is already existed columm.

    like : ((GridViewDataColumn)VReportViewer.GrdReport.Columns["Notes"]).DataMemberBinding = new Binding() { Converter = new RichTextFormat()};

    if i use aboue line : i am getting error :

    illegal xml character [Line: 1 Position: 2]

    Let me know how can i use this converts in code bedhind.

    I am using converters in code behind.

    I have follwed below link :

    From Telerik forum

    Like :

    GridViewDataColumn column = new GridViewDataColumn();

    column.DataMemberBinding = new Binding("Notes") { Converter = new RichTextFormat() };

    VReportViewer.GrdReport.Columns.Add(column);

    It is adding as a new column to the grid and data showing correctly.

    But problem is...it is adding as new column to RadGridview.

    I have to assign this converts ..that is already existed columm.

    like : ((GridViewDataColumn)VReportViewer.GrdReport.Columns["Notes"]).DataMemberBinding = new Binding() { Converter = new RichTextFormat()};

    if i use aboue line : i am getting error :

    illegal xml character [Line: 1 Position: 2]

    Let me know how can i use this converts in code bedhind.

  2. kavitha
    kavitha avatar
    10 posts
    Member since:
    Jun 2011

    Posted 08 Jan 2014 Link to this post

    I have solved this problem. by keeping code in GrdReport_AutoGeneratingColumn.

    Like ;
     
      var dataColumn = e.Column as GridViewDataColumn;
                                    dataColumn.DataMemberBinding = new Binding("Notes") { Converter = new RichTextFormat() };
  3. DevCraft banner
Back to Top