1

我实际上使用 BCS 连接到外部内容,我可以在 SharePoint 中看到该列表,但是当我尝试通过 VS Web 部件使用该列表时,我收到此连接错误,但是当我从加载事件调用列表时会发生这种情况当我从 button_click 事件中调用它时,它工作得很好,请一些帮助将不胜感激,这里是代码:

protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack) loadPeoplesBDay();
        }

public void loadPeoplesBDay()
        {
            if (WebPart.List == null) return;

            SPWeb Web = SPContext.Current.Web;
            SPList List = Web.Lists[WebPart.List];

            var q = List.Items;
            var onomasticos = from persona in q.Cast<SPItem>()
                              where Convert.ToDateTime(persona["FE_NACI_TRAB"]).Month == DateTime.Now.Month
                              orderby Convert.ToDateTime(persona["FE_NACI_TRAB"]).Day ascending
                              select new { Nombre = persona["NO_TRAB"] + " " + persona["NO_APEL_PATE"] + " " + persona["NO_APEL_MATE"], Area = persona["DE_SECC"], DiaNacimiento = Convert.ToDateTime((Convert.ToDateTime(persona["FE_NACI_TRAB"]).Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year)), Mes = persona["FE_NACI_TRAB"] };

            dlst_Onomasticos.DataSource = onomasticos;
            dlst_Onomasticos.DataBind();
        }
4

0 回答 0