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

  • 相关阅读:
    C计算double能精确到多少位
    C计算int最大值、最小值
    AndroidStudio右键new无activity
    java替换特殊字符串 $
    lamda表达式排序
    docker toolbox 设置镜像加速
    tomcat优化
    nginx配置相关
    SQL 优化
    elasticsearch 概念初识
  • 原文地址:https://www.cnblogs.com/woshare/p/4304963.html
Copyright © 2011-2022 走看看