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

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

1 Answer 29 Views
GridView
This is a migrated thread and some comments may be shown as answers.
kavitha
Top achievements
Rank 1
kavitha asked on 04 Jan 2014, 07:03 AM
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.

1 Answer, 1 is accepted

Sort by
0
kavitha
Top achievements
Rank 1
answered on 08 Jan 2014, 12:08 PM
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() };
Tags
GridView
Asked by
kavitha
Top achievements
Rank 1
Answers by
kavitha
Top achievements
Rank 1
Share this question
or