实现一个客户端的DataSet-----index.htm
<!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大师精品文章赏析 更多相关文章
|
推荐文章
精彩文章
|