Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->编程语言 ->ASP.NET ->正文

实现一个客户端的DataSet-----index.htm

来源:Linuxdby.com 作者:Webmaster 时间:2007-04-28 点击: [收藏] [投稿]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<TITLE>客户端DataSet</TITLE>
<SCRIPT>
var iRowIdx = 0;

function init()
{
    services.useService("ClientDataSetDataProvider.asmx?WSDL", "clientdatasetdataprovider");
    loadData();
}
function loadData()
{
    services.clientdatasetdataprovider.callService(loadresult, "GetPubs");
}
function loadresult(result)
{
    if (result.error) {
        alert(result.errorDetail.string);
    }
    else {
        dsPubs.ReadXml(result.value);
        iRowIdx = 0;
        updateButtons();


        dataBind();
    }
}
function dataBind()
{
    var oTable = dsPubs.GetTable("authors");
    if (oTable) {
        var oRow = oTable.GetRow(iRowIdx);
        if (oRow) {
            txtAuthorID.value    = oRow.GetValue("au_id");
            txtFirstName.value    = oRow.GetValue("au_fname");
            txtLastName.value    = oRow.GetValue("au_lname");
            txtPhone.value        = oRow.GetValue("phone");
            txtAddress.value    = oRow.GetValue("address");
            txtCity.value        = oRow.GetValue("city");
            txtState.value        = oRow.GetValue("state");
            txtZip.value        = oRow.GetValue("zip");
            chkContract.checked    = (oRow.GetValue("contract") == "true") ? true : false;
            return;
        }
    }

    txtAuthorID.value    = "";
    txtFirstName.value    = "";
    txtLastName.value    = "";


    txtPhone.value        = "";
    txtAddress.value    = "";
    txtCity.value        = "";
    txtState.value        = "";
    txtZip.value        = "";
    chkContract.value    = false;
}
function text_onBlur()
{
    var sDataFld = event.srcElement.getAttribute("datafld");
    var oTable = dsPubs.GetTable("authors");
    if (oTable) {
        var oRow = oTable.GetRow(iRowIdx);
        if (oRow) {
            oRow.SetValue(sDataFld, event.srcElement.value);


        }
    }
}
function checkbox_onBlur()
{
    var sDataFld = event.srcElement.getAttribute("datafld");
    var oTable = dsPubs.GetTable("authors");
    if (oTable) {
        var oRow = oTable.GetRow(iRowIdx);
        if (oRow) {
            oRow.SetValue(sDataFld, event.srcElement.checked.toString().toLowerCase());
        }
    }
}
function updateButtons()
{
    var oTable = dsPubs.GetTable("authors");

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx   下一篇:KW大师精品文章赏析

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号