小编sre*_*ree的帖子

禁用datagridview中的按钮列

我有一个数据网格视图有4列,前两列是组合框列,第三列是文本框列,第四列是按钮列.在表单加载我必须禁用datagrid的整个按钮列,在此之后我应该选择前三列和保存后,将这三个列保存在数据库中,特定行中的按钮列应该启用.应该通过单击按钮将第一列保存在数据库中.请帮助我解决这个问题很多天这里是我使用的代码

private void SATAddTemplate_Load(object sender, EventArgs e)
{
           foreach (DataGridViewRow row in datagrdADDTEMP.Rows)
           {

               DataGridViewButtonCell btn = (DataGridViewButtonCell)row.Cells[3];
               btn.ReadOnly = true;
           }
}
 private void btnSaveSettings_Click(object sender, EventArgs e)
     {
           foreach (DataGridViewRow row in datagrdADDTEMP.Rows)
           {

               DataGridViewButtonCell btn = (DataGridViewButtonCell)row.Cells[3];
               btn.ReadOnly = false;
           }
     }
Run Code Online (Sandbox Code Playgroud)

c# datagridview

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

使用Enterprise库创建滚动平面日志文件

在我的Web应用程序中,我正在尝试创建用于记录错误和异常的日志文件,但是当我运行应用程序时,日志文件未在我的解决方案文件夹或bin文件夹中创建.

我使用了以下代码.请帮帮我,我遇到了这个问题,提前谢谢你.

使用的命名空间

using Microsoft.Practices.EnterpriseLibrary.Logging;

using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
Run Code Online (Sandbox Code Playgroud)

.cs文件

        public int GetdeskKMasterRecordsCount(string CircleId, string StoreId)
        {
            try
            {
               throw new Exception("this is normal exception");

            }
            catch (Exception ex)
            {
                BindLog(ex);
                return 0;
            }
        }


        public static void BindLog(Exception ex)
        {
            if (ex == null) return;
            Logger.Write(LogInformation(1, DateTime.Now, ex.Message, " "));

        }

        public static LogEntry LogInformation(int eventId, DateTime timeStamp, string message, string documentName)
        {
            LogEntry logEntryObject = new LogEntry();
            logEntryObject.EventId = eventId;
            logEntryObject.Title = documentName;
            logEntryObject.TimeStamp = timeStamp;
            logEntryObject.MachineName = System.Environment.MachineName;
            logEntryObject.Message …
Run Code Online (Sandbox Code Playgroud)

asp.net logging enterprise-library

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

无法将类型'System.Collections.Generic.List <System.Collections.Generic.IEnumerable <xxx >>'隐式转换为'System.Collections.Generic.List <xxx>

我收到以下错误.我用Google搜索了一天多,但我找不到确切的解决方案,请帮帮我谢谢

错误:无法隐式转换 System.Collections.Generic.List<System.Collections.Generic.IEnumerable<ADCO.eJMC.EntityDataModel.ShareholderUser>>System.Collections.Generic.List<ADCO.eJMC.EntityDataModel.ShareholderUser>

我使用了以下代码

List<ShareholderUser> list = new List<ShareholderUser>();
list = dataContext.EJMCShareholderApprovals
                  .Include(s => s.Shareholder.ShareholderUsers)
                  .Where(e => e.EJMCRequestId == requestId)
                  .Select(s => s.Shareholder.ShareholderUsers
                                .Where(x => x.AccessMode == true))
                  .ToList();
Run Code Online (Sandbox Code Playgroud)

c# entity-framework

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

AES 256 文件加密 C#

我似乎找不到使用 AES 256 加密在 c# 中加密文件的好示例

有人有一些示例代码吗?

c# asp.net aes

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