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

[Solved] display xml in cells

4 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Milosz
Top achievements
Rank 1
Milosz asked on 10 Sep 2009, 10:09 AM
i have values e.g. <some text> which i want to display in radgrid cell, i don't know why text started with < end ended with > does not appear in cell?

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Sep 2009, 10:30 AM
Hi Milosz,

Try using:
 &lt -  for less-than
&gt- for greater-than

i.e.  use  &lt some text &gt instead of <some text> and see whether you are able to display the desired cell text.

Princy
0
Milosz
Top achievements
Rank 1
answered on 10 Sep 2009, 10:36 AM
ok but i bind grid with datasource, i could use HttpUtility.HtmlEncode but do i have to iterate for each cell to modyfi text? if so how to iterate every column in itemdatabound event using GridDataItem?
0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Sep 2009, 11:37 AM
Hi,

Give a try with the following code snippet to loop through the entire cells of a Grid.

CS:
 
protected void RadGrid2_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid2.MasterTableView.Items) 
        { 
            foreach (GridColumn col in RadGrid2.MasterTableView.RenderColumns) 
            { 
                string strtxt = item[col.UniqueName].Text.Replace(">""&gt"); 
                string strtxt1 = strtxt.Replace("<""&lt"); 
                item[col.UniqueName].Text = strtxt1; 
 
            } 
        } 
    }  


Shinu
0
Milosz
Top achievements
Rank 1
answered on 21 Sep 2009, 10:53 AM
hi, it's me again
issue descriped above works in IE, but unfortunately not in Firefox, what can solve this problem?
Tags
Grid
Asked by
Milosz
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Milosz
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or