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;
                }
      }

  • 相关阅读:
    [DB] 数据库的连接
    JS leetcode 翻转字符串里的单词 题解分析
    JS leetcode 拥有最多糖果的孩子 题解分析,六一快乐。
    JS leetcode 搜索插入位置 题解分析
    JS leetcode 杨辉三角Ⅱ 题解分析
    JS leetcode 寻找数组的中心索引 题解分析
    JS leetcode 移除元素 题解分析
    JS leetcode 最大连续1的个数 题解分析
    JS leetcode 两数之和 II
    JS leetcode 反转字符串 题解分析
  • 原文地址:https://www.cnblogs.com/woshare/p/4304963.html
Copyright © 2011-2022 走看看