Saturday, March 24, 2012

about itemView Databind

I'm sorry for my poor english :)

javascript:

function ShowEdit()
{
Sunlinks.WebOA.Web.Services.CommonCodeService.GetOne(onGetComplete);
}
function onGetComplete(result)
{
var templ= $('divcontent').control;
templ.set_data(result);

}

function onSaveComplete(result)
{
alert(result);
}
function savedatas()
{

var templ= $('divcontent').control;
var result=templ.get_data();
Sunlinks.WebOA.Web.Services.CommonCodeService.SaveCommonCode(result,onGetComplete);

}

html:

<input id="Button1" type="button" value="edit" onclick="ShowEdit();" />

<input id="Button2" type="button" onclick="savedatas();" value="button" />

<div id="divcontent" ></div>

<div id="detailsTemplate">
<input id="txtName" type="text" /><br />
<input id="txtFullName" type="text" /><br />
<input id="txtShortName" type="text" /><br />
<input id="txtCode" type="text" /><br />
<input id="txtOrder_num" type="text" /><br />
<input id="chkIsClose" type="checkbox" /><br />
</div>

<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>


<itemView id="divcontent">
<itemTemplate>
<template layoutElement="detailsTemplate">
<textBox id="txtName">
<bindings>
<binding dataPath="Name" property="text" direction="InOut"/>
</bindings>
</textBox>
<textBox id="txtFullName">
<bindings>
<binding dataPath="FullName" property="text" direction="InOut"/>
</bindings>
</textBox>
</template>
</itemTemplate>
</itemView >
</components>
</page>

now the question:

tmpl.set_data(); work fine

but when txtFullName or txtName lost fouce then atlas throw a error

but when I change direction="In" ,it's no error

hello.

well, it looks like waht you0re trying to accomplish can only be done through a datasource:

http://atlas.asp.net/docs/atlas/doc/data/default.aspx#itemview

Thank USmile [:)]

No comments:

Post a Comment