protected override void OnLoad(EventArgs e) { base.OnLoad(e); GridDataSource.Include = _table.ForeignKeyColumnsNames; // Disable various options if the table is readonly if (_table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; GridView1.EnablePersistedSelection = false; } var dataSourceTable = GridDataSource.GetTable(); GridView1.ColumnsGenerator = new HideColumnFieldsManager(dataSourceTable); if (!IsPostBack && !IsAsync) { if (Request.UrlReferrer != null) { if (Request.UrlReferrer.ToString().Contains("Edit.aspx")) { if (Session[PageIndexKey] != null) { GridView1.PageIndex = (int)Session[PageIndexKey]; } } } } }
protected void Page_Init(object sender, EventArgs e) { table = GridDataSource.GetTable(); DynamicDataManager1.RegisterControl(GridView1, true /*setSelectionFromUrl*/); GridView1.EnablePersistedSelection(); GridView1.ColumnsGenerator = new AdvancedFieldGenerator(table, true); DynamicDataFutures.RegisterListDefaults(GridDataSource, InsertHyperLink); }
protected void Page_Load(object sender, EventArgs e) { // Get the table entity. _table = GridDataSource.GetTable(); // Assign title dynamically. Title = string.Concat("Applying the DataTypeAttribute to ", _table.Columns[9].DisplayName, " Data Field"); }
protected void Page_Load(object sender, EventArgs e) { // Get the table entity. _table = GridDataSource.GetTable(); // Assign title dinamically. Title = string.Concat("Applying the DisplayFormatAttribute to ", _table.DisplayName, " Table"); }
protected void Page_Load(object sender, EventArgs e) { // Get the table entity. _table = GridDataSource.GetTable(); // Assign title dynamically. Title = string.Concat("Customize <i>Phone</i> Data Field Validation", "Using a Custom Attribute"); }
protected void Page_Load(object sender, EventArgs e) { table = GridDataSource.GetTable(); Title = table.DisplayName; // Disable various options if the table is readonly //if (table.IsReadOnly) { // //GridView1.Columns[0].Visible = false; //} }
protected void Page_Load(object sender, EventArgs e) { MetaTable table = GridDataSource.GetTable(); Title = table.DisplayName; GridDataSource.Include = table.ForeignKeyColumnsNames; GridDataSource.AutoGenerateWhereClause = false; // Disable various options if the table is readonly GridView1.ItemCommand += new GridCommandEventHandler(GridView1_ItemCommand); }
protected void Page_Load(object sender, EventArgs e) { // Get the table entities. _table1 = GridDataSource.GetTable(); _table2 = GridDataSource2.GetTable(); // Assign title dynamically. Title = string.Concat("Customize Validation of the ", _table1.Name, " and ", _table2.Name, " Tables"); }
protected void Page_Load(object sender, EventArgs e) { table = GridDataSource.GetTable(); Title = table.DisplayName; InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert); // Отключите разнообразные параметры, если таблица доступна только для чтения if (table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { table = GridDataSource.GetTable(); Title = table.DisplayName; InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert); // Disable various options if the table is readonly if (table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { table = GridDataSource.GetTable(); Title = table.DisplayName; InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert); // 如果表是只读的,则禁用各选项 if (table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { MetaTable table = GridDataSource.GetTable(); Title = table.DisplayName; // Disable various options if the table is readonly if (table.IsReadOnly) { DetailsPanel.Visible = false; GridView1.AutoGenerateSelectButton = false; GridView1.AutoGenerateEditButton = false; GridView1.AutoGenerateDeleteButton = false; } }
protected void Page_Load(object sender, EventArgs e) { table = GridDataSource.GetTable(); Title = table.DisplayName; InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert); // Disable various options if the table is readonly if (table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; } // Add handler to manage delete button based on role. //GridView1.PreRender += new EventHandler(GridView1_PreRender); }
protected void Page_Load(object sender, EventArgs e) { MetaTable table = GridDataSource.GetTable(); Title = table.DisplayName; // Отключите разнообразные параметры, если таблица доступна только для чтения if (table.IsReadOnly) { DetailsPanel.Visible = false; GridView1.AutoGenerateSelectButton = false; GridView1.AutoGenerateEditButton = false; GridView1.AutoGenerateDeleteButton = false; } }
protected void Page_Load(object sender, EventArgs e) { MetaTable table = GridDataSource.GetTable(); Title = table.DisplayName; // 如果表是只读的,则禁用各选项 if (table.IsReadOnly) { DetailsPanel.Visible = false; GridView1.AutoGenerateSelectButton = false; GridView1.AutoGenerateEditButton = false; GridView1.AutoGenerateDeleteButton = false; } }
protected void Page_Load(object sender, EventArgs e) { table = GridDataSource.GetTable(); Title = table.DisplayName; GridDataSource.Include = table.ForeignKeyColumnsNames; InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert); // Disable various options if the table is readonly if (table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; } //GridDataSource.OrderBy = "InvoiceNumber"; if (!Page.IsPostBack) { GridView1.Sort("DateEntered", SortDirection.Descending); } }
protected void GridDetailDataSource_Selecting(object sender, Microsoft.AspNet.EntityDataSource.EntityDataSourceSelectingEventArgs e) { GridDataItem parentItem = ((GridNestedViewItem)e.DataSource.NamingContainer).ParentItem; int hierarchyIndex = parentItem != null ? parentItem.ItemIndex : -1; if (hierarchyIndex == -1) { e.Cancel = true; return; } MetaTable masterMetaTable = GridDataSource.GetTable(); MetaTable detailMetaTable = e.DataSource.GetTable(); StringBuilder sb = new StringBuilder(); sb.Append(Helpers.PersianSearchDataSourceHelpers.GetValidUniCodeQuery(e.DataSource.Where)); if (masterMetaTable.ForeignKeyColumnsNames != string.Empty) { //Many to One relation foreach (MetaColumn column in detailMetaTable.PrimaryKeyColumns) { foreach (string name in masterMetaTable.ForeignKeyColumnsNames.Split(',')) { string columnName = ((MetaForeignKeyColumn)masterMetaTable.GetColumn(name)).ForeignKeyNames.Where(n => n == name + "." + column.Name).FirstOrDefault(); GridTableView ownerTableView = ((GridNestedViewItem)e.DataSource.NamingContainer).OwnerTableView; if (!ownerTableView.DataKeyNames.Contains(columnName)) { continue; } if (sb.Length > 0) { sb.Append(" AND "); } sb.AppendFormat("it.{0} = '{1}'", column.Name, ownerTableView.DataKeyValues[hierarchyIndex][columnName]); //break; } } } //else //{ //One to Many relation foreach (MetaColumn col in detailMetaTable.Columns) { if (col is MetaForeignKeyColumn) { MetaForeignKeyColumn column = (MetaForeignKeyColumn)col; if (column.ParentTable.Name == masterMetaTable.Name) { int primarykeyindex = 0; // in relations witch has mor than one foreign key column foreach (string name in column.ForeignKeyNames) //maybe { GridTableView ownerTableView = ((GridNestedViewItem)e.DataSource.NamingContainer).OwnerTableView; string columnName = name;//.Split('.')[1]; //if (!ownerTableView.DataKeyNames.Contains(columnName)) //maybe spel of foreignkey in child table does not equla to primary key in parrent table // continue; switch (masterMetaTable.PrimaryKeyColumns[primarykeyindex].ColumnType.Name) { case "Int16": case "Int32": case "Int64": if (sb.Length > 0) { sb.Append(" AND "); } sb.AppendFormat("it.{0} = {1}", name, ownerTableView.DataKeyValues[hierarchyIndex][masterMetaTable.PrimaryKeyColumns[primarykeyindex].Name]); //its depond on our chance witch is the orders of foeign key and parimary in master table should be equal break; default: if (sb.Length > 0) { sb.Append(" AND "); } sb.AppendFormat("it.{0} = '{1}'", name, ownerTableView.DataKeyValues[hierarchyIndex][masterMetaTable.PrimaryKeyColumns[primarykeyindex].Name]); //its depond on our chance witch is the orders of foeign key and parimary in master table should be equal break; } primarykeyindex++; //break; } break; } } } //} e.DataSource.Where = sb.ToString(); }
// Perform page elements initialization. protected void Page_Init(object sender, EventArgs e) { // Get the metadata of the current table. table = GridDataSource.GetTable(); }