小编Tim*_*Tim的帖子

DevExpress XtraGrid自定义RowCellStyle事件处理程序和列排序问题

我的xtraGrid有一个自定义样式eventlistener:

  FooGridView.RowCellStyle += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(FooGridView_RowCellStyle);


  private void FooGridView_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {

            DevExpress.XtraGrid.Views.Grid.GridView vw = (sender as DevExpress.XtraGrid.Views.Grid.GridView);
            try
            {
                DataRow DR = vw.GetDataRow(vw.GetRowHandle(e.RowHandle));

                if (**some condition based on one or more values in the DataRow**)
                {
                    e.Appearance.Font = new System.Drawing.Font(e.Appearance.Font, System.Drawing.FontStyle.Strikeout);
                    e.Appearance.ForeColor = Color.LightGray;
                }
                else
                {
                    e.Appearance.Font = new System.Drawing.Font(e.Appearance.Font, System.Drawing.FontStyle.Regular);
                    e.Appearance.ForeColor = Color.Black;
                }

            }
            catch (Exception ex) { }
        }
Run Code Online (Sandbox Code Playgroud)

单击网格列标题以占用网格后,格式最终会在排序重新排序行之后应用于错误的行.如何解决这个问题?

devexpress xtragrid

4
推荐指数
1
解决办法
7553
查看次数

PostgreSQL Extract() DOW:除了时间戳之外,为什么不使用日期数据类型?

根据 PostgreSQL 版本 8.1 日期时间函数文档

dow 一周中的哪一天(0 - 6;星期日为 0)(仅适用于时间戳值

SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40');
Result: 5
Run Code Online (Sandbox Code Playgroud)

为什么日期数据类型不是该函数的有效参数?如果一周中各天的顺序不随区域设置而改变:

  0 - 6; Sunday is 0 
Run Code Online (Sandbox Code Playgroud)

为什么需要组合日期类型值的时间部分来确定一周中一天的序号?仅仅日期块还不够吗?

postgresql date extract dayofweek ordinal

4
推荐指数
1
解决办法
2万
查看次数

C#中私有无参数构造函数的用途是什么

我刚收到Jon Skeet在邮件中的深度C#,我没有按照第7-8页的讨论.

我们现在有一个私有的无参数构造函数,用于新的基于属性的初始化.(第8页)

我不清楚基于属性的初始化如何需要无参数构造函数,如果这是"为了"的意思.

class Product
{
   public string Name { get; private set;}
   public decimal Price { get; private set;}
   public Product (string name, decimal price)
   {
     Name = name;
     Price = price;
   }
   Product(){}
   .
   .
   .
}    
Run Code Online (Sandbox Code Playgroud)

目的是Product(){} 什么?

c#-3.0

4
推荐指数
1
解决办法
630
查看次数

使用C#将系统日期转换为M/d/yyyy格式,而不考虑系统格式

M/d/yyyy无论使用C#的日期系统格式如何,我如何获得今天的格式日期?

DateTime.Now.Tostring('M/d/yyyy')
Run Code Online (Sandbox Code Playgroud)

仅当系统日期为格式dd/MM/yyyyM/dd/yyyy但不是格式化时才起作用yyyy-MM-dd.

例如:

如果系统日期2013-06-26,然后DateTime.Now.Tostring('M/d/yyyy')被转换成日期06-26-2013,但不06/26/2013

c# datetime date

4
推荐指数
3
解决办法
1万
查看次数

Knockout条件样式的"未绑定"SELECT元素的选项元素

我页面上的各种输入都通过敲除绑定到视图模型,比方说客户记录.这一切都很好.

现在,我想在页面顶部放置一个SELECT,其中包含所有客户的列表.用户将选择一个客户,该记录将从数据库中获取,并且数据将绑定到视图模型.

我的问题涉及SELECT列表中项目的条件样式.它将绑定到一组客户对象.Customer对象定义有一个名为hasExpired的函数:

   var Customer = function (id, name, expiryDate) {
    this.id = id;
    this.customerName = name;
    this.expiryDate = expiryDate;
    this.hasExpired =  function() {
        return this.expiryDate == null ? false : true; 
      };
    };
Run Code Online (Sandbox Code Playgroud)

ViewModel,页面上的输入绑定到的ViewModel如下所示:

      function ViewModel() {
            var self=this;
             self.customerRegion = ko.observable(),
             self.customerName = ko.observable(),
             .
             .
             .
             self.allCustomers = Customers,  // Customers is an array of Customer objects
             self.selectedCustomer = ko.observable()



     }
Run Code Online (Sandbox Code Playgroud)

这个淘汰赛绑定工作; SELECT正确填充了客户列表:

    <select id="customerSelect" 
             data-bind="options: allCustomers,
            optionsText: 'customerName', 
            value:   selectedCustomer />
Run Code Online (Sandbox Code Playgroud)

我想为单个OPTIONS设置样式,如果合适,添加"过期"类. …

css conditional knockout.js

4
推荐指数
1
解决办法
2308
查看次数

iTextSharp PdfStamper.PartialFormFlattening 仅展平部分字段,而不是全部字段

下面的代码正确地将值“foo”分配给命名字段,但该字段没有被“扁平化”。我肯定忽略了一个步骤,但我不知道那是什么。请指教。谢谢。

public byte[] FlattenSpecifiedFormFields(byte[] b, List<string> fieldNames2Flatten)
    {
        PdfReader reader = new PdfReader(b);
        using (var ms = new MemoryStream())
        {
            var stamper = new iTextSharp.text.pdf.PdfStamper(reader, ms);               
            foreach (string name in fieldNames2Flatten)
            {

                stamper.AcroFields.SetField(name, "foo");
                stamper.PartialFormFlattening(name);
            }

            stamper.Close();
            return ms.ToArray();
        };
    }
Run Code Online (Sandbox Code Playgroud)

itext

4
推荐指数
1
解决办法
1618
查看次数

如何将存储过程#1的结果存入存储过程#2中的临时表

我试图将几个存储过程的结果合并到一个临时表中.各种存储过程的结果具有相同的列结构.从本质上讲,我想UNION ALL各种存储过程的结果.一个重要的事实:每个存储过程都创建一个临时表来存储其数据,每个返回的结果都基于对临时表的选择:

create proc SP1    
as
 .
 .  <snip>
 .
 select * from #tmp   -- a temporary table
Run Code Online (Sandbox Code Playgroud)

注意,select * from OPENQUERY(server, 'exec SP1')如果SP1中的select对临时表不起作用(有关详细信息,请参阅此问题),是否有另一种方法可以将不同的存储过程SP2发送到临时表中执行SP1的结果?

  create proc SP2 as
  -- put results of executing SP1 into a temporary table:
  .
  .
  .
Run Code Online (Sandbox Code Playgroud)

注意:无法修改SP1(例如,将其结果存储在具有会话范围的临时表中).

stored-procedures temp-tables sql-server-2012

3
推荐指数
1
解决办法
1万
查看次数

使用imageMapster调整响应式图像映射:我是否误解了scaleMap的作用?

当使用CSS设置图像来增大或缩小以占据容器DIV中的可用空间时,必须采取哪些步骤来保持图像 - 地图区域坐标与不断变化的图像大小同步?

img {
    /*  border: 2px dotted red; */
    width:100% !important;
    max-width: none !important;
    height: auto !important;
}
div {width: 100%; height: auto}
Run Code Online (Sandbox Code Playgroud)

插件的scaleMap: true属性是否处理这种情况?或者必须采取其他措施?我单独使用scaleMap无法让它工作,但也许我误解了scaleMap的作用.它是否处理用户拖动浏览器窗口更宽或更窄,以及平板设备方向更改的情况?

http://jsfiddle.net/juvyh/1309/

image-resizing responsive-design imagemapster

3
推荐指数
1
解决办法
9297
查看次数

如何在剑道模态窗口上隐藏关闭按钮

我的角度应用程序中有一个剑道模态窗口。有时我在一秒钟后自动关闭窗口。在那些时候,我想隐藏“关闭[x]”按钮,但在其他时候,不是。可以在打开窗口之前完成吗?

    if (autoCloseDelay)        {
        // hide the close [x]  button here ??
        $timeout( function() {
            $scope.modalWindow.close();
        }, autoCloseDelay, $scope);
    }
    $scope.modalWindow.open();
Run Code Online (Sandbox Code Playgroud)

kendo-ui kendo-window

3
推荐指数
1
解决办法
5171
查看次数

错误:ZLibStreamHandle类型的SafeHandle或CriticalHandle无法正确释放

我没有用过很多关于流的工作,所以我认为这里有一个编码错误.

   public static SqlBytes Compress(SqlBytes input)
    {
        byte[] data = (byte[])input.Value;
        using (MemoryStream memstream = new MemoryStream(data))
        {

            using (GZipStream zipped = new GZipStream(memstream, CompressionMode.Compress))
            {
                using (MemoryStream output = new MemoryStream()) 
                {
                    zipped.CopyTo(output);
                    return new SqlBytes(output.ToArray());
                }

            }

        }
    }
Run Code Online (Sandbox Code Playgroud)

这是SQL Server 2012 CLR中的错误:

Msg 10323, Level 16, State 49, Line 1
Invalid user code has been identified by .Net Framework Managed Debug Assistant 'releaseHandleFailed':
A SafeHandle or CriticalHandle of type 'ZLibStreamHandle' failed to properly release the handle with …
Run Code Online (Sandbox Code Playgroud)

c# dispose gzipstream safehandle

3
推荐指数
1
解决办法
1326
查看次数