Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alert when a new record is added on a page

Status
Not open for further replies.

phytos

Technical User
Oct 20, 2002
15
0
0
CY
i have a custom web application that retrieves data from the database for orders that are not completed. i have the page to auto refresh every 1 min. I would like to find a way to alert with a popup msg when a new order is added on the datagrid.


Thanks in advanced
 
Save the record count to ViewState (or Session) then check if it changes on PostBack, using RegisterClientScriptBlock to cause the prompt:

if( !IsPostBack )
{
int recordCount;

//determine recordCount

ViewState["records"] = recordCount;
}
else
{
int newRecordCount;
int oldRecordCount;

oldRecordCount = (int)ViewState["records"] );

//determind new record count

if( oldRecordCount != newRecordCount )
{
Page.RegisterClientScriptBlock("AlertScript",
"<script language='javascript'>alert('record count changed')</script>");

//update record count in ViewState
ViewState["records"] = newRecordCount;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top