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

GridDropDownColumn HTMLEncode

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
H
Top achievements
Rank 1
H asked on 04 Dec 2009, 04:31 PM

why doesn't the GridDropDownColumn have the HTMLEncode propery???
I works well in the combobox but in the grid there will be problems without the encoding.

Do I need to HTMLEncode in databound? How?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Dec 2009, 07:45 AM
Hi,

You can access the DropDownColumn text in the ItemDataBound event of the grid and encode it as shown below:
c#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
       if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            dataItem["DropDownColumnUniqueName"].Text = Server.HtmlEncode(dataItem["DropDownColumnUniqueName"].Text);           
 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
H
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or