private void AddColumn_Click(object sender, EventArgs e) { int r = V.FocusedRowHandle; if (r == GridControl.NewItemRowHandle) // just return if on new row { RulesGrid.Focus(); // put focus back // V.ShowEditor(); return; } if (r < 0) { r = 0; } else { r = r + 1; } DataRow dr = DataTable.NewRow(); DataTable.Rows.InsertAt(dr, r); //RulesGrid.InsertRowAt(r); // RulesGrid.EditCell(r, LabelCol); RulesGrid.Refresh(); //int rowCount = DataTable.Rows.Count; return; }
//------------------------------------------------------------------------------------------------------------- private void RuleDownButton_Click(object sender, EventArgs e) //------------------------------------------------------------------------------------------------------------- { int rowCurrent = RulesGrid.CurrentCell.RowIndex; int colCurrent = RulesGrid.CurrentCell.ColumnIndex; if (rowCurrent < (rules.Count - 1)) { int rowNew = rowCurrent + 1; rules.Move(rowCurrent, rowNew); RulesGrid.Refresh(); RulesGrid.CurrentCell = RulesGrid.Rows[rowNew].Cells[colCurrent]; RulesGrid_CellBeginEdit(sender, e); UpdateUIState(); } }
public void DisplayAccessRules(string virtualFolderPath) { if (!virtualFolderPath.StartsWith(VirtualImageRoot) || virtualFolderPath.IndexOf("..") >= 0) { /* * Dan Clem, 3/15/2007: from my brief testing, it appears that this may not be necessary, since ASP.NET seems to prevent this inherently, throwing this error: * Cannot use a leading .. to exit above the top directory. * I'm keeping it anyway, 'cause that's how 4guys did it. */ throw new ApplicationException("An attempt to access a folder outside of the website directory has been detected and blocked."); } Configuration config = WebConfigurationManager.OpenWebConfiguration(virtualFolderPath); SystemWebSectionGroup systemWeb = (SystemWebSectionGroup)config.GetSectionGroup("system.web"); AuthorizationRuleCollection authorizationRules = systemWeb.Authorization.Rules; RulesGrid.DataSource = authorizationRules; RulesGrid.DataBind(); TitleOne.InnerText = "Rules applied to " + virtualFolderPath; TitleTwo.InnerText = "Create new rule for " + virtualFolderPath; }