0

Hi. I have a test program written in VS 2005 with a DataGrid in it. The records are fetched from the database but I have a weird problem. The grid does not display the data if it starts with a Less Than symbol '<'. All it shows is a white space. When I check it on VS Visualizer, the data is being fetched correctly with the Less Than symbol.

The reason why I used a DataGrid instead of GridView is because the real application that I'm trying to fix was originally from VS2003 and just migrated to VS2005.

Here is my sample code:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class frmGrid : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            BindData();
    }

    private void BindData()
    {
        DatabaseConnection db = new DatabaseConnection();
        GridView1.DataSource = db.GetAllClients();
        GridView1.DataBind();
    }

    protected void GridView1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
    {
        GridView1.CurrentPageIndex = e.NewPageIndex;
        BindData();
    }
}
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by ChrisHunter
0

I'd suspect it has something to do with the fact that < is the start of an HTML statement. Try convert it to &lt;

0

have you tried converting it to a string when it is fetched from the DB and just treating it as a string until your putting it back in the DB or is that not possible in this case ?

Edited by ChrisHunter: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.