vishesh kumar
Top achievements
Rank 1
vishesh kumar
asked on 19 Sep 2010, 06:57 AM
Hi,
I have used radgrid to display some search records. However, I am not able to records like "<keyword>" which are however returned from the stored procedure and part of the datasource that is used to bind.
This is my column definition.
Can you please let me know if there is a workaround for this or this is a feature?
I have used radgrid to display some search records. However, I am not able to records like "<keyword>" which are however returned from the stored procedure and part of the datasource that is used to bind.
<
telerik:GridHyperLinkColumn
DataTextFormatString
=
"{0}"
DataNavigateUrlFields
=
"Id"
DataNavigateUrlFormatString
=
"/sites/abc/xyz/vhj/Pages/view.aspx?id={0}&ReturnUrl=/Pages/Search.aspx"
UniqueName
=
"ItemTitle"
DataTextField
=
"Title"
HeaderText
=
"Title"
SortExpression
=
"Title"
HeaderStyle-CssClass
=
"ms-toolbar"
HeaderStyle-Width
=
"17%"
HeaderStyle-HorizontalAlign
=
"Left"
ItemStyle-HorizontalAlign
=
"Left"
ItemStyle-Wrap
=
"true"
SortAscImageUrl
=
"/_layouts/Images/abc/SortAsc.gif"
SortDescImageUrl
=
"/_layouts/Images/abc/SortDesc.gif"
DataType
=
"System.String"
>
</
telerik:GridHyperLinkColumn
>
Can you please let me know if there is a workaround for this or this is a feature?
8 Answers, 1 is accepted
0
Hello Vishesh,
You should set the HtmlEncode property to true - this way RadGrid will encode the HTML-like content automatically.
Regards,
Daniel
the Telerik team
You should set the HtmlEncode property to true - this way RadGrid will encode the HTML-like content automatically.
<telerik:GridBoundColumn HtmlEncode="true" ...
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Stimo
Top achievements
Rank 1
answered on 26 Aug 2012, 07:27 PM
Hi,
You can do that if your column is GridBoundColumn, but what about GridTemplateColumn? It doesn't have HtmlEncode property
You can do that if your column is GridBoundColumn, but what about GridTemplateColumn? It doesn't have HtmlEncode property
0
Hello Stimo,
You should manually encode the text when using templates.
In such cases, you can use the HtmlEncode method:
Regards,
Daniel
the Telerik team
You should manually encode the text when using templates.
In such cases, you can use the HtmlEncode method:
Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tonino
Top achievements
Rank 1
answered on 14 Oct 2016, 09:15 AM
Hi!
Is there a way to set HtmlEncode="true" for the whole Grid? Or for the whole project?
Regards,
Tonino.
0
Hello Tonino,
There is no built-in functionality to set HtmlEncode property for all columns. If suitable for you, it is possible to traverse the columns collection and assign the property to all bound columns programmatically.
For autogenerated columns try the following approach:
Customizing auto-generated columns
Regards,
Daniel
Telerik by Progress
There is no built-in functionality to set HtmlEncode property for all columns. If suitable for you, it is possible to traverse the columns collection and assign the property to all bound columns programmatically.
foreach
(GridColumn col
in
RadGrid4.Columns)
{
GridBoundColumn boundCol = col
as
GridBoundColumn;
if
(boundCol !=
null
)
{
boundCol.HtmlEncode =
true
;
}
}
For autogenerated columns try the following approach:
Customizing auto-generated columns
Regards,
Daniel
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Tonino
Top achievements
Rank 1
answered on 14 Oct 2016, 01:49 PM
Thanks Daniel for your quick reply!
Where do I have to put the code to loop throu the columns?
Regards,
Tonino.
0
Hello Tonino,
You could try to set the HtmlEncode property on page load:
Regards,
Daniel
Telerik by Progress
You could try to set the HtmlEncode property on page load:
protected
void
Page_Load(
object
sender, EventArgs e)
{
foreach
(GridColumn col
in
RadGrid1.Columns)
{
GridBoundColumn boundCol = col
as
GridBoundColumn;
if
(boundCol !=
null
)
{
boundCol.HtmlEncode =
true
;
}
}
}
Regards,
Daniel
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Vibhu
Top achievements
Rank 1
answered on 28 Feb 2018, 02:39 PM
Hi!
Is there a way to set HtmlEncode="true" for the whole project? Like Config or application level?
We are using the Radgrid throughout the application and want to set HtmlEncode for all the respective gridboundcolumn.
Like for
Regards,
Vibhu