<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RowInsertUpdateDelete.aspx.cs" Inherits="DataGrid_RowInsertUpdateDelete" %>
<%@ Register TagPrefix="APNSoft" Namespace="APNSoft.WebControls" Assembly="APNSoftControls" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>

    <script type="text/javascript">

    function InsertTheRow(){
        
        //Validate CustomerID
        var CustomerID = dg.GetEditFormElement('myDataGrid', 'txtCustomerID');
        if(CustomerID.value == ''){
            alert('Please enter a valid Customer ID.');
            return;
        }
        
        //Validate CompanyName
        var CompanyName = dg.GetEditFormElement('myDataGrid', 'txtCompanyName');
        if(CompanyName.value == ''){
            alert('Please enter a valid Company Name.');
            return;
        }
        
        dg.InsertRow();
    };


    function UpdateTheRow(){
        
        //Validate CompanyName
        var CompanyName = dg.GetEditFormElement('myDataGrid', 'txtCompanyName');
        if(CompanyName.value == ''){
            alert('Please enter a valid Company Name.');
            return;
        }

        dg.UpdateRow();
    };

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <APNSoft:APNSoftDataGrid id="myDataGrid" runat="server"
        SkinFolder = "~/DataGrid/Skins/GrayScale/"
        width = "550" 
        height = "250" 
        
        EditForm-Path = "~/DataGrid/Templates/EditForm.ascx"
        EditForm-PositionInsert = "CenterOfGrid"
        EditForm-PositionUpdate = "CenterOfGrid"
        ConfirmTextDelete = "Are you sure?"
    />






    </div>
    </form>
</body>
</html>