How to check grid has value or not and display no record found?

To check gridview if null
http://www.netomatix.com/development/gridviewclientsideaccess.aspx
<script language=”javascript” type=”text/javascript”>
var gridViewCtlId = ‘<%=ctlGridView.ClientID%>’;
    var gridViewCtl = null;
    var curSelRow = null;
    var curRowIdx = -1;
    function getGridViewControl()
    {
        if (null == gridViewCtl)
        {
            gridViewCtl = document.getElementById(gridViewCtlId);
     if (null == gridViewCtl)
            {
  alert(“No Record Found”);
     }
        }
    }
   
    function onGridViewRowSelected(rowIdx)
    {
        var selRow = getSelectedRow(rowIdx);
        if (null != selRow)
        {
            curSelRow = selRow;
            var cellValue = getCellValue(rowIdx, 0);
            alert(cellValue);
        }
    }
   
    function getSelectedRow(rowIdx)
    {
        return getGridRow(rowIdx);
    }
   
    function getGridRow(rowIdx)
    {
        getGridViewControl();
        if (null != gridViewCtl)
        {
            return gridViewCtl.rows[rowIdx];
        }
        return null;
    }
   
    function getGridColumn(rowIdx, colIdx)
    {
        var gridRow = getGridRow(rowIdx);
        if (null != gridRow)
        {
            return gridRow.cells[colIdx];
        }
        return null;
    }
   
    function getCellValue(rowIdx, colIdx)
    {
        var gridCell = getGridColumn(rowIdx, colIdx);
        if (null != gridCell)
        {
            return gridCell.innerText;
        }
        return null;
    }
</script>  

        If (Me._dtTasks.Rows.Count = 0) Then
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), “”, “alert(‘No record found’);”, True)
        End If

ASPNET_REGIIS.EXE
http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

Advertisements
This entry was posted in ASP.NET 2 and C# 2 and Javascript. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s