ComponentArt Grid 行部分字段Insert操作

第一次写博客,水平可能有限,希望大家提出宝贵的改进意见

主要介绍下,在ComponentArt中,对于Insert操作,要先设置下AutoCallBackOnInsert="true",然后写上:
<ClientTemplates>
                
<ComponentArt:ClientTemplate ID="InsertCommandTemplate" runat="server">
                    
<href="javascript:insertRow();">Insert</a> | <href="javascript:Grid1.EditCancel();">Cancel</a>
                
</ComponentArt:ClientTemplate>
 
</ClientTemplates>

在insertRow()这个脚本中写上:
function insertRow()
{
    Grid1.EditComplete(); 
}
这个时候,点击Insert,然后获取值后,就可以将数据插入到数据库中了。

这类Insert操作只是很简单和比较常见的,将所有列的值都从Grid中获取到即可,想了解详细的,请参考ComponentArt的live_example 或者:http://www.componentart.com,这里都有详细的介绍

我想说的是,如果并不是每列都作为要插入的字段的话,那么,这样设置是不会执行服务器端的ComponentArt.Web.UI.Grid.GridItemEventHandler 这个委托事件的

所以,如果要想引发该委托事件,则必须将脚本insertRow()写为:
function insertRow()
{
    Grid1.EditingDirty 
= true;
    Grid1.EditComplete(); 
}
这样就可以了

呵呵,如有说的不对的地方,请大家批评,我会改正,谢谢

posted on 2008-07-17 23:26  ZHLee  阅读(587)  评论(0编辑  收藏  举报

导航