|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Accounts._Default" %>
<!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 id="Head1" runat="server">
<title>Accounts</title>
<script type='text/javascript' language="javascript">
function fnBindGrid()
{
PostXmlHttp('AjaxAccess.asmx/WsBindGrid', 'CBBindGrid', 'SQL=SELECT * FROM ACCOUNTTYPES');
}
function CBBindGrid()
{
//State Description
//0 The request is not initialized
//1 The request has been set up
//2 The request has been sent
//3 The request is in process
//4 The request is complete
try
{
if (xmlHttp.readyState==4)
{
document.all.item("HiddenDiv").style.display = "none";
ParseXml(xmlHttp.responseText);
if(returnParseXml != null)
{
var myData = [,];
myData = eval(returnParseXml.childNodes[0].nodeValue);
var htmlTable;
if(myData.length > 0)
{
var rows = myData.length;
var columns = myData[0].length;
//loop through the rows
htmlTable = '<TABLE>';
for( i = 0 ; i < rows ; i++)
{
htmlTable += '<TR>';
//loop through the columns
for( j = 0 ; j < columns ; j++ )
{
htmlTable += '<TD>';
htmlTable += myData[i][j];
htmlTable += '</TD>';
//alert(myData[i][j]);
}
htmlTable += '</TR>';
}
htmlTable += '</TABLE>';
CustTable.innerHTML = htmlTable;
}
}
else
alert('Failed: Return XML not found');
}
}
catch(e)
{
alert(e.Message);
}
}
function fnSaveAccountType()
{
PostXmlHttp('AjaxAccess.asmx/WsSaveAccountType', 'CBSaveAccountType', 'AccountType='+Trim(document.all.item("txtAccountType").value));
}
function CBSaveAccountType()
{
//State Description
//0 The request is not initialized
//1 The request has been set up
//2 The request has been sent
//3 The request is in process
//4 The request is complete
try
{
if (xmlHttp.readyState==4)
{
document.all.item("HiddenDiv").style.display = "none";
ParseXml(xmlHttp.responseText);
if(returnParseXml != null)
{
if(Trim(returnParseXml.childNodes[0].nodeValue) == 'Success')
{
alert('Saved Successfully');
fnBindGrid();
}
else
alert(returnParseXml.childNodes[0].nodeValue);
}
else
alert('Failed: Return XML not found');
}
}
catch(e)
{
alert(e.Message);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id='CustTable'></div>
<asp:GridView ID="gvAccountTypes" runat="server"></asp:GridView>
<input id="txtAccountType" type="text" />
<input id="Button1" type="button" value="Save" onclick="fnSaveAccountType()" />
</div>
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.