I am populating gridview using xmldatasource and i have applied ajax timer control for grid also. That control will refresh the grid for every 5 minutes. My question is "If i add new record in xml file that record will be populate in the grid. Here i have to show one label called "new". It means this is the new record added in the grid.
How to do? Pls give me suggession?
Thanks in advance....

ramesh p66 reputationPosted Apr 12, 2009, 11:48 PM EDT
Create one XML file called Symbol.xml;
static int rowsCount;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadGrid();
string xmlFilePath = Server.MapPath(@"App_Data/Symbols.xml");
if (File.Exists(xmlFilePath))
{
DataSet ds1 = new DataSet();
ds1.ReadXml(xmlFilePath);
rowsCount = ds1.Tables[0].Rows.Count;
}
}
}
private void LoadGrid()
{
string xmlFilePath = Server.MapPath(@"App_Data/Symbols.xml");
if (File.Exists(xmlFilePath))
{ using (DataSet ds = new DataSet())
{
ds.ReadXml(xmlFilePath);
grdvAutoRefresh.DataSource = ds;
grdvAutoRefresh.DataBind();
if (rowsCount > 0)
{
int rows = ds.Tables[0].Rows.Count;
int remrows = rows - rowsCount;
if (remrows > 0)
{
for (int i = rowsCount; i < ds.Tables[0].Rows.Count; i++)
{
grdvAutoRefresh.Rows[i].Cells[3].Text = grdvAutoRefresh.Rows[i].Cells[3].Text + " " + "New";
rowsCount = rows;
}
}
else if (remrows < 0)
{
rowsCount = rows;
}
}
}
}
}
protected void Timer1_Tick(object sender, EventArgs e)
{
LoadGrid();
}