using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using GZTW.AyaNova.BLL; using Telerik.Web.UI; public partial class MemoToChooser : BaseThemePage { #region BizObject public DataTable mdtTo; protected DataTable dtTo { get { if (mdtTo != null) return mdtTo; if(Request.QueryString["id"]==null) throw new ApplicationException("MemoToChooser - Userlist DataTable session id not provided"); mdtTo = (DataTable)Session["memoto"+Request.QueryString["id"].ToString()]; if(mdtTo==null) throw new ApplicationException("MemoToChooser - Userlist DataTable session id specified not found in session"); return mdtTo; } } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) {RadGrid1.DataSource = dtTo; this.Title = Util.LocaleText("Memo.Label.ToID"); RadGrid1.MasterTableView.Columns.FindByUniqueName("RECIPIENT").HeaderText = Util.LocaleText("O.User"); RadGrid1.MasterTableView.Columns.FindByUniqueName("RECIPIENTTYPE").HeaderText = Util.LocaleText("User.Label.UserType"); RadGrid1.MasterTableView.Columns.FindByUniqueName("SUBCONTRACTOR").HeaderText = Util.LocaleText("User.Label.SubContractor"); } } protected void Page_LoadComplete(object sender, EventArgs e) { if (IsPostBack) { foreach (GridDataItem i in RadGrid1.Items) { //Use extract values to get the ID which is the only column //you can get this way, likely because it's a hidden column Hashtable newValues = new Hashtable(); i.OwnerTableView.ExtractValuesFromItem(newValues, i); //Since the checkbox is in a template column you have to retrieve //it by the control CheckBox c = i.FindControl("ckSelected") as CheckBox; //We have the checkbox control and we have the id value so update it //in the dataset UpdateData(new Guid(newValues["RECIPIENTID"].ToString()), c.Checked); } } } private void UpdateData(Guid ID, bool bSelected) { foreach (DataRow dr in dtTo.Rows) { if ((Guid)dr["RECIPIENTID"] == ID) { dr["SELECTED"] = bSelected; return; } } } protected void btnSave_Click(object sender, ImageClickEventArgs e) { lblScript.Text = "