When I set htmlencode=false in webdatagrid it shows only data with html format. it works fine. no problem in that.
I have used doucment exporter to print the data in pdf format. when print to pdf it shows with html tag.
Can anyone help to proceed further.
Hello DayanaArul,
I'm following up to see if you have solved your issue.
Hi DayanaArul,
This is expected behavior, because the document exporter exports the whole content of the grid cells. In your scenario they contain html tags, so they will be exported as text, too. A possible solution would be to add hidden unbound field for each column which is not html encoded. On InitializeRow event get the values from these columns, remove html tags and set the new values to the hidden column. Before exporting to pdf, show the hidden columns and hide the columns with HtmlEncode=”false”.
protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
{
//Get e.Row.Items.FindItemByKey("ID").Text and remove html tags. You should implement the FormatValue method as per your requirements
string newValue = FormatValue(e.Row.Items.FindItemByKey("ID").Text);
e.Row.Items.FindItemByKey("ID-Hidden").Text = newValue;
}
protected void ButtonExport_Click(object sender, EventArgs e)
WebDataGrid1.Columns["ID"].Hidden = true;
WebDataGrid1.Columns["ID-Hidden"].Hidden = false;
WebDocumentExporter1.Export(WebDataGrid1);
Let me know if you have any questions.