zoukankan      html  css  js  c++  java
  • supergridcontrol记录,分页

    sqlserver分页记录

    select top 50 DengJiBH,sSuoYouQuanShenQingRen,sZuoLuo,sQiuHao,sQuanHao,ChaXun_BianHao,rownumber,zZhuCeLXBH,sMianJi,gDengJiLXBH
    from(
    select row_number() over(order by isnull(Zi.DengJiBH,'00000000')) as rownumber, 
    dj_DengJi.DengJiBH,dj_DengJi.sSuoYouQuanShenQingRen,Zi.sZuoLuo,Zi.sQiuHao,
    Zi.sQuanHao,isnull(Zi.DengJiBH,'00000000') as ChaXun_BianHao,Zi.zZhuCeLXBH,Zi.sSuoYouQuanZH,zi.sMianJi,zi.gDengJiLXBH
    from dj_DengJi 
    left join dj_DengJi Zi on dj_DengJi.DengJiBH=Zi.zPiDengJiBH 
    where dj_DengJi.gQuanLi=4 and dj_DengJi.gWanCheng<>1 
    and dj_DengJi.sSuoYouQuanShenQingRen like '%鑫苑万卓%' 
    and Zi.sZuoLuo like '%高铁新城%'
    --and dj_DengJi.DengJiBH='151004824 '
    ) b
    where rownumber>(50*(1-1)) order by rownumber
    

      

    superGridControl 复制单元格文本:

            private void superGridControl2_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
                {
                    var pos = PointToClient(MousePosition);
                    pos.Y -= this.superGridControl2.Parent.Location.Y;
                    var cell = this.superGridControl2.PrimaryGrid.GetElementAt(pos.X, pos.Y);
                    var col = this.superGridControl2.PrimaryGrid.GetColumnAt(pos);
                    if (cell != null && col != null)
                    {
                        var txt = (cell as GridRow).Cells[col].Value.ToString();
                        Clipboard.SetDataObject(txt, true);
                        ToastNotification.Show(this.Parent, "已复制" + txt, Xiang.Business.Properties.Resources.close_16px,
                           2000, eToastGlowColor.Blue, eToastPosition.TopCenter);
                    }
                }
            }
    

      

    显示行头序号,从1开始

    this.superGridControl2.PrimaryGrid.ShowRowGridIndex = true;
    this.superGridControl2.PrimaryGrid.RowHeaderIndexOffset = 1;

    选中行对象:

    GridRow row = this.superGridControl2.PrimaryGrid.GetSelectedRows().FirstOrDefault() as GridRow;
    var arc = row.DataItem as ArchivementDto;

    选中行按回车:

            private void superGridControl2_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    SelectedElementCollection col = this.superGridControl2.PrimaryGrid.GetSelectedRows();
                    if (col.Count > 0)
                    {
                        e.Handled = true;
                        GridRow row = col[0] as GridRow;
                        var item = row.DataItem as ApplySheetListDto;
    
                        var dlg = new ApplyDetailDialog(item.applyId);
                        var pos = PointToScreen(this.gridColumn3.LocationRelative);
                        dlg.Location = pos;
                        dlg.ShowDialog();
                    }
                }
                else if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
                {
                    var pos = PointToClient(MousePosition);
                    pos.Y -= this.superGridControl2.Parent.Location.Y;
                    var cell = this.superGridControl2.PrimaryGrid.GetElementAt(pos.X, pos.Y);
                    var col = this.superGridControl2.PrimaryGrid.GetColumnAt(pos);
                    if (cell != null && col != null)
                    {
                        var txt = (cell as GridRow).Cells[col].Value.ToString();
                        Clipboard.SetDataObject(txt, true);
                        ToastNotification.Show(this.Parent, "已复制" + txt, Xiang.Business.Properties.Resources.close_16px,
                           2000, eToastGlowColor.Blue, eToastPosition.TopCenter);
                    }
                }
            }
    

      

    单个文本设置颜色:

            private void superGridControl1_GetCellStyle(object sender, GridGetCellStyleEventArgs e)
            {
                if (e.StyleType != StyleType.Default) { return; }
    
                var cell = e.GridCell as GridCell;
                if (cell == null) { return; }
    
                if (cell.Value.ToString() == "历史")
                {
                    e.Style.TextColor = Color.Red;
                }
            }
    

      

  • 相关阅读:
    手机端上传图片及java后台接收和ajaxForm提交
    JEECG中datagrid方法自定义查询条件
    微信分享到朋友圈按钮 右上角提示
    Js获取后台集合List的值和下标的方法
    redis系列之数据库与缓存数据一致性解决方案
    替换{0}为指定的字符串(MessageFormat)
    java中对array数组的常用操作
    面试题-Java Web-网络通信
    你应该知道的JAVA面试题
    各大互联网公司java开发面试常问问题
  • 原文地址:https://www.cnblogs.com/yansc/p/10137065.html
Copyright © 2011-2022 走看看