Open the _ScriptLibrary/DATAGRID.ASP
Add a Grid property...
function _DataGrid(strName,objParent)
{
// public members
this.id = strName;
this.name = strName;
//Message if the recordset is closed or empty
// (no grid is drawn)
this.strMessageWhenEmpty = '';
then adjust the display method (watch where you add the curly braces!)...
function _DG_display(bReturnText)
{
var strHTML = '';
if (this._bVisible)
{
var objRS = this._objDataSource;
if (!(objRS != null && !objRS._isEmpty())) {
// MessageWhenEmpty feature
//recordset is null or empty
if (this.strMessageWhenEmpty != '') {
strHTML = this.strMessageWhenEmpty;
}
}
else
{
...rest of the display routine...
}
}
this._preserveState();
if (bReturnText != true)
..etc..
On your ASP page...
grdGrid.strMessageWhenEmpty = "<B>Empty.</B>"
The grid will forget the message between server round-trips, so always set the message text on page load - or add more code to the Grid DTC - this time to the 'preserveState()/restoreState()' methods:
function _DG__preserveState()
{
if (this.maintainState)
{ // preserve state in hidden field
var state = new Object;
state._bVisible = this._bVisible;
if (this.allColumns)
state.allColumns = true;
//save MessageWhenEmpty feature
if (this.strMessageWhenEmpty != '')
state.strMessageWhenEmpty = this.strMessageWhenEmpty;
...etc...
function _DG__restoreState()
{
var r = false;
this._fireEvent(this._funcInit);
if (this.maintainState)
{
var state = thisPage.unpersistState(this.name);
if (state != null)
{
//restore MessageWhenEmpty feature
if (state.strMessageWhenEmpty != null)
this.strMessageWhenEmpty
= state.strMessageWhenEmpty;
...etc...
(Content Management)