locked
Datagrid with data that happens to look like XML RRS feed

  • Question

  • I have a datagrid bound to a SQLDataReader in our product.   The code is VERY simple:

                        sc.CommandText = strSQL;
                        sdr = sc.ExecuteReader();
                        dgReport.DataSource = sdr;
                        dgReport.DataBind();
                        sdr.Close();
    Everything seemed to work fine until a sneaky tester created data that contained things like "<AAA>" and "</BBB>".  In the databound control those fields are simply blank.  The row exists and other fields are present in that row but the XML-like data is simply discarded.  I have verified the data is correctly present in the SqlDataReader.  Do I have to manually handle the grid to escape the XML?

    Thanks!

    Friday, January 14, 2011 9:35 PM

Answers