protected void Identifier_Edit(object sender, DataGridCommandEventArgs e) { int index = e.Item.ItemIndex; grid.EditItemIndex = index; SetEditMode(); PopulateDataGrid(); if (index >= identifierBag.Count) { identifierBag.Add(); } KeyedReference keyedReference = identifierBag[index]; DropDownList list = (DropDownList)grid.Items[index].Cells[0].FindControl("tModelKey"); if (null != list) { ListItem item = list.Items.FindByValue(keyedReference.TModelKey.Substring(5)); if (null != item) { item.Selected = true; } } }
protected void CategoryChooser_OnSelect(object sender, DataGridCommandEventArgs e) { KeyedReference keyedReference = categoryBag[categoryBag.Add()]; CategoryBrowserControl b = (CategoryBrowserControl)GetControl("browser", 1); keyedReference.TModelKey = "uuid:" + b.TModelKey; keyedReference.KeyName = HttpUtility.HtmlDecode(b.KeyName); keyedReference.KeyValue = b.KeyValue; if (null != entity) { entity.Save(); } if (null != cache) { cache.Save(); } grid.EditItemIndex = -1; CancelEditMode(); CategoryBag_DataBind(false); }