ASP.NET补充

字典类的子集

using System.Collections.Generic;

 Dictionary<string, string> dicB = new Dictionary<string, string>() 
                {
                  {"B1",""},{"B2",""},{"B3",""},{"B4",""},{"B5",""},
                  {"B6",""},{"B7",""},{"B8",""},{"B9",""},{"B10",""}
                };

当使用字典类时,循环

                foreach (KeyValuePair<string, string> item in dicB)
                {
                    wth.UseBookmark(doc, item.Key, item.Value);
                }

网页中的锚定

  可以快速定位到某一个元素。

     <a href="#Label1">回话</a>   //点击这个就可以定位到ID位Label1这个元素     格式为 href='#ID'
   <asp:Label ID="Label1" runat="server" Text="我要哭了"></asp:Label>

如果不是a标签怎么定位,我们做点击事件

   $("#Label2").click(function () {
                location.href = "#Label1";  //一个道理
            });

如果在一般处理程序中使用到了Session,需要继承 IRequiresSessionState

必须先引用

取此条数据的上一条数据和下一条数据

//先把数据全部取出来,用Lis<T>来保存
List<Model.Boda_Information> listInfo = new BLL.Boda_Information().GetModelList(
                " ReleaseUser='" + infoModel.ReleaseUser + "' and InfoType=" + infoModel.InfoType + " order by ReleaseTime desc  ");  
      
                Model.Boda_Information firtModel = null;
                if (listInfo.Any(x => x.ID < infoModel.ID))   //需要做判断   存不存在比这条数据小的ID
                {
                    firtModel = listInfo.Where(x => x.ID < infoModel.ID).OrderByDescending(x => x.ID).First(); //上一篇  倒序排
                }
                Model.Boda_Information nextModel = null;
                if (listInfo.Any(x => x.ID > infoModel.ID))
                {
                    nextModel = listInfo.Where(x => x.ID > infoModel.ID).OrderBy(x => x.ID).First();//下一篇 正序排                
                }
原文地址:https://www.cnblogs.com/Sea1ee/p/7244703.html