コード例 #1
0
        public IList <object> GetListSelectedKeys(System.Web.UI.WebControls.ListView listView)
        {
            var res = new List <object>();

            foreach (var idx in ControlUtils.GetChildren <System.Web.UI.HtmlControls.HtmlInputCheckBox>(listView).Where(c => c.Checked && c.ID == "checkItem" && !String.IsNullOrEmpty(c.Value)).Select(c => Convert.ToInt32(c.Value)))
            {
                res.Add(listView.DataKeys[idx].Values.Count > 1 ? listView.DataKeys[idx].Values : listView.DataKeys[idx].Value);
            }
            return(res);
        }
コード例 #2
0
        public int GetListViewRowCount(System.Web.UI.WebControls.ListView listView)
        {
            var pager = ControlUtils.GetChildren <DataPager>(listView).FirstOrDefault();

            if (pager != null)
            {
                return(pager.TotalRowCount);
            }
            if (listView.Items != null)
            {
                return(listView.Items.Count);
            }
            return(-1);
        }