Posted on 2007-03-06 16:03
BoyLee 阅读(1089)
评论(2) 编辑 收藏
原创文章,转载请注明出处
作者: BoyLee 出处: Http://BoyLee.net
关于WebGrid的最后一讲啦,主要是一些简单前台/后台操作小例子
1.前台验证某列是否为日期格式
<asp:customvalidator id="vldRaiJyo" runat="server" ControlToValidate="txtTrick"> </asp:customvalidator>
getMsg_Val("W00250", Message, Me.vldRaiJyo.ErrorMessage)
Me.vldRaiJyo.ClientValidationFunction = "checkRaiJyo"
function checkRaiJyo(source, arguments)

{
var gn='uwgCustomer';
var g=igtbl_getGridById(gn);
var table=g.Bands[0].curTable;
var rows=table.tBodies[0].rows;
var rows_num=rows.length-1; // Check range: All of them except the last item.
var cell;
var cell_value;
//for(var i=document.frmPara.hdnEx.value; i<rows_num; i++){ // The exsiting customer data won't be checked.

for(var i=document.frmEvent.hdnEx.value; i<rows_num; i++)
{ // The exsiting customer data won't be checked.
cell=igtbl_getCellById(gn+'rc_'+i+'_'+1);
cell_value=cell.getValue();

if(cell_value!='' && cell_value!=null)
{

if(!chkDate(cell_value))
{
arguments.IsValid=false;
return;
}
}
}
arguments.IsValid=true;
}
一个简单的小例子,其实就是和DataGrid前台操作的方法差不多了
一些属性可以自己查看
上一章的一些说明
2.其实后台我不知道该说些什么.建议大家自己多动手尝试.
后台和DataGrid一样,写个WebGrid的ID,然后后面加个".",然后就出来了,自己看吧,很多属性和方法的
rowCus("ATTEND_DATE") = Me.uwgCustomer.Rows(intI).Cells(1).Value
rowCus("CUSTOMERS_FIRST_NAME") = Me.uwgCustomer.Rows(intI).Cells(2).Value
rowCus("CUSTOMERS_LAST_NAME") = Me.uwgCustomer.Rows(intI).Cells(3).Value
rowCus("CUSTOMERS_FIRST_NAME_KANA") = Me.uwgCustomer.Rows(intI).Cells(4).Value
rowCus("CUSTOMERS_LAST_NAME_KANA") = Me.uwgCustomer.Rows(intI).Cells(5).Value
rowCus("TEL_NUMBER") = Me.uwgCustomer.Rows(intI).Cells(6).Value
rowCus("POSTAL_CODE1") = Me.uwgCustomer.Rows(intI).Cells(7).Value
rowCus("POSTAL_CODE2") = Me.uwgCustomer.Rows(intI).Cells(8).Value
rowCus("BTN_SEARCH") = "検索"
rowCus("SEL_ADDR") = Me.uwgCustomer.Rows(intI).Cells(10).Value
rowCus("ADDR1") = Me.uwgCustomer.Rows(intI).Cells(11).Value
rowCus("ADDR2") = Me.uwgCustomer.Rows(intI).Cells(12).Value
OK,全部结束啦.
当然,我只是讲了一点点基本的东西,WebGrid的强大和便捷还是要靠大家自己去发现
其实写这几篇的目的,主要是因为自己用的时候,很多东西不熟悉,而搜索的结果是根本没几篇中文的文章
也难怪,WebGrid主要是日本用的多,所以文档也是日文的居多.抛砖引玉,写了点简单的,希望能对用到WebGrid的新手朋友们有点点帮助,不要象俺开始做WebGrid时一样痛苦.相信有了这几篇入门级的文章,下面的开发对大家来说,应该要容易多了.