zoukankan      html  css  js  c++  java
  • c# 委托

    在EXtgrid类中

     public delegate bool DeleteEvent(string selStr);

        public DeleteEvent OnDeleteEvent{get;set;}

      protected void btnDelete_Click(object sender, EventArgs e)     {         DoDelete();     }

        public void DoDelete()     {        

    string sel = GetRowsSelected();        

    if (sel == "")      

       {             Alert.Show("请选择一条数据!");          

       return;         }      

       if (OnDeleteEvent != null)//委托给使用者实现      

       {            

    try            

    {                

    if (OnDeleteEvent(sel))                

    {                     Alert.Show("删除成功!");                     BindGrid();                 }             

        else                

    {                     Alert.Show("删除失败!");                 }             }         

        catch            

    {                 Alert.Show("删除失败!数据存在引用关系,请查找");             }         }     }

    在继承Extgrid类的页面中,实现委托删除操作

    private bool deleteRecord(string recordID)
      {
         int flag = 0;
       try
       {
        string wherecondition="";
        wherecondition=" where SEQ in("+recordID+")";
                    t_access = new B_CardAccess(this.connStr);
                    flag=t_access.ExecuteDelRecord(wherecondition);
        this.Log("删除");
        
       }
       catch
       {
                   
       }
       if (flag > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
      }

  • 相关阅读:
    Anniversary party
    1358. 分割树
    我在 impress.js 中学到的小套路
    我对 impress.js 源码的理解
    CSS transition 过渡 详解
    CSS 2D转换 matrix() 详解
    JS 动画基础
    JS 瀑布流布局
    JS 下拉菜单
    JS Resizable Panel 练习
  • 原文地址:https://www.cnblogs.com/woshare/p/4304963.html
Copyright © 2011-2022 走看看