protected void repRoles_ItemCommand(object source, RepeaterCommandEventArgs e) { DataRow row = SelectedRoles.NewRow(); row["Name"] = ((Label)repRoles.Items[e.Item.ItemIndex].FindControl("ltrlRoleNM")).Text; row["Id"] = row["Name"]; this.SelectedRoles.Rows.Add(row); ((LinkButton)this.repRoles.Items[e.Item.ItemIndex].FindControl("selectbtn")).Enabled = false; this.RepSelected.DataSource = this.SelectedRoles; this.RepSelected.DataBind(); this.repRoles.DataSource = Telerik.Security.UserManager.Default.GetAllRoles(); this.repRoles.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.TemplateId = new Guid(HttpContext.Current.Request.QueryString["TemplateId"]); this.EventId = new Guid(HttpContext.Current.Request.QueryString["EventId"]); this.ModuleId = new Guid(HttpContext.Current.Request.QueryString["ModuleId"]); this.manager = new DataManager(); this.SelectedRoles.Clear(); this.SelectedGroups.Clear(); foreach (IRecipientRole cuurentRole in manager.GetRecipientRolesRelatedToEvent(ModuleId, EventId, TemplateId)) { DataRow row = SelectedRoles.NewRow(); row["Name"] = cuurentRole.RoleName; row["Id"] = row["Name"]; this.SelectedRoles.Rows.Add(row); } foreach (IRecipientGroup cuurentGroup in manager.GetRecipientGroupsRelatedToEvent(ModuleId, EventId, TemplateId)) { DataRow row = this.SelectedGroups.NewRow(); row["Name"] = cuurentGroup.Group.GroupName; row["Id"] = cuurentGroup.Group.GroupId; this.SelectedGroups.Rows.Add(row); } this.RepSelected.DataSource = this.SelectedRoles; this.RepSelected.DataBind(); } // bind to user repeater control this.repRoles.DataSource = Telerik.Security.UserManager.Default.GetAllRoles(); this.repRoles.DataBind(); manager = new DataManager(); this.RepGroups.DataSource = manager.GetGroups(string.Empty); this.RepGroups.DataBind(); this.radTabStrip.TabClick += new Telerik.Web.UI.RadTabStripEventHandler(radTabStrip_TabClick); }
protected void SelectAllbtn_Click(object sender, EventArgs e) { if ((LinkButton)sender == SelectAllGroupsbtn) { IList AllGroups = manager.GetGroups(string.Empty); this.SelectedGroups.Clear(); foreach (IGroup currentGroup in AllGroups) { DataRow row = this.SelectedGroups.NewRow(); row["Name"] = currentGroup.GroupName; row["Id"] = currentGroup.GroupId; this.SelectedGroups.Rows.Add(row); } this.RepSelected.DataSource = this.SelectedGroups; this.RepSelected.DataBind(); this.RepGroups.DataBind(); } else if ((LinkButton)sender == selectAllRolesbtn) { System.Collections.Generic.List <string> allRoles = new System.Collections.Generic.List <string>(); allRoles.AddRange(Telerik.Security.UserManager.Default.GetAllRoles()); this.SelectedRoles.Clear(); for (int index = 0; index < allRoles.Count; index++) { DataRow row = SelectedRoles.NewRow(); row["Name"] = allRoles[index]; row["Id"] = row["Name"]; this.SelectedRoles.Rows.Add(row); } this.RepSelected.DataSource = this.SelectedRoles; this.RepSelected.DataBind(); this.repRoles.DataBind(); } }