好的,我按如下方式解决了我的问题,因为我无法通过使用将自己限制在页面在视图中提供的 50 条记录 SelectedControlSelectedAllItemIds
,因为 xml 总共只获取 50 个 guid。所以现在按钮调用 ASP 页面的 JAVASCRIPT URL,这是 c# 中的代码:
EntityCollection retrieved = GetInformacaoDB(new_teste.EntityLogicalName.ToString());
DataSet ds1 = new DataSet();
DataTable dt = new DataTable("List");
dt.Clear();
dt.Columns.Add(new DataColumn("Description", typeof(string)));
foreach (var c in retrieved.Entities)
{
GridView1.Visible = false;
DataRow dr = dt.NewRow();
dr["Description"] = c.Attributes["new_testid"];
object _test = c.Attributes["new_testid"];
string testGuid = _test.ToString();
Guid _testId = new Guid(testGuid);
Entity EntityName = new EntityName("new_test");
ColumnSet attributes = new ColumnSet(new string[] { "new_testid" });
EntityName = _orgService.Retrieve(EntityName.LogicalName, _testId, attributes);
entidade["new_onoff"] = "OffViaWebService";
_orgService.Update(EntityName);
dt.Rows.Add(dr);
}
ds1.Tables.Add(dt);
GridView1.DataSource = ds1;
GridView1.DataBind();
Cache["Data"] = ds1;