【问题标题】:How to check if column of GridView is empty, and if it is, make a button invisible?如何检查GridView的列是否为空,如果是,使按钮不可见?
【发布时间】:2011-08-29 03:44:07
【问题描述】:

我有这个代码:

var data = File.ReadAllLines(Server.MapPath("~/Uploaded"))
              .Select(line => line.Split(','))
              .Select(columns => new { GuestName = ErrorMessage(columns[0]), 
                                       Guest_ID = ErrorMessage(columns[1]), 
                                       IC_Number = ErrorMessage(columns[2]) });
            if (data = 0)//this if statement is wrong
            {
                BtnImport1.Visible = false;
            }

我想检查GridView 中的列/行是否为空,如果是,我想让BtnImport 变为不可见。谁能帮我解决这个问题? =/

【问题讨论】:

    标签: c# asp.net linq gridview


    【解决方案1】:
    if (data.Count() == 0)//this if statement is wrong
    {
        BtnImport1.Visible = false;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-09
      • 2014-04-13
      相关资源
      最近更新 更多