1.RadToolBar客户端实现点击确认。

RadToolBar中加入OnClientButtonClicking="clientButtonClicking"

然后在脚本中进行确认

            function clientButtonClicking(sender, args)
            {
                 if (args.get_item().get_text()=="上报")
                 {
                    if (!window.confirm("确认要上报?上报后的数据不能修改!"))
                    {
                        args.set_cancel(true);
                    }
                 }
            }

 

2.RadGrid在客户端实现提示

RadGrid中设置

                                <ClientSettings>
                                    <ClientEvents OnCommand="onClientButtonClicking" />
                                </ClientSettings>

 

加入脚本

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

        <script type="text/javascript">
         <!--
            function onClientButtonClicking(sender, args)
            {
                if (args.get_commandName() == "Delete")
                {
                    var grid = $find("<%= RadGrid1.ClientID %>");
                    var view = $find("<%= RadGrid1.MasterTableView.ClientID %>");
                    var items = view.get_dataItems();
                    var item = items[args.get_commandArgument()];

        //usercount必须为主键,如果usercount不是表的主键,在Grid中设置ClientDataKeyNames为复合主键。

        //如ClientDataKeyNames="id,usercount"
                    var usercount = item.getDataKeyValue("usercount");
                    if (usercount>0)
                    {
                        alert("有用户在使用该角色,不能删除。");
                        args.set_cancel(true);
                    }
                }
            }
            -->
        </script>

    </telerik:RadCodeBlock>

posted on 2009-06-25 11:12  *小小黄*  阅读(807)  评论(0编辑  收藏  举报