protected void btnBindResource_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.hfldResourceId.Value)) { ISerializable serializable = new JsonSerializer(); string[] array = serializable.Deserialize <string[]>(this.hfldResourceId.Value); List <string> list = new List <string>(); if (array != null) { this.UpdateSelectResources(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string item = array2[i]; list.Add(item); } List <ConstructResource> all = ConstructResource.GetAll(this.consTaskId, list); List <ConstructResource> list2 = this.ViewState["ResourcesList"] as List <ConstructResource>; foreach (ConstructResource current in all) { if (!list2.Contains(current)) { list2.Add(current); } } this.ViewState["ResourcesList"] = list2; this.gvResource.DataSource = list2; this.gvResource.DataBind(); } } this.hfldResourceId.Value = string.Empty; }
protected void BindGv() { List <string> resourceIds = ConstructResource.GetResourceIds(this.consTaskId); List <ConstructResource> all = ConstructResource.GetAll(this.consTaskId, resourceIds); this.ViewState["ResourcesList"] = all; this.gvResource.DataSource = all; this.gvResource.DataBind(); }