Binding Datagrid with SPList

To be honest, I was struggling a bit to bind the SPList with the datagrid... and found the way to do so.



Comments

  1. This ia two years late. But, thanks for the usefull tip. One thing I relealized, is that you require elivated privileges to do this (atleast in my applicaiton).

    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
    List = new SPSite(list.ParentWeb.Site.ID).AllWebs[list.ParentWeb.ID].Lists[list.ID];
    });

    this.dgvList.DataSource = List.Items.GetDataTable();

    Shrini Viswanathan

    ReplyDelete

Post a Comment