コード例 #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

            ds.ContextCreated += (_, ctxCreatedEnventArgs) => ObjectContext = ctxCreatedEnventArgs.Context;

            ds.Updating  += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
            ds.Inserting += new EventHandler <EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TextBox1.MaxLength = Column.MaxLength;
            if (Column.MaxLength < 20)
            {
                TextBox1.Columns = Column.MaxLength;
            }
            TextBox1.ToolTip = Column.Description;

            SetUpValidator(RequiredFieldValidator1);
            SetUpValidator(RegularExpressionValidator1);
            SetUpValidator(DynamicValidator1);
            SetUpValidator(CusValidator);
            Microsoft.AspNet.EntityDataSource.EntityDataSource ds = (Microsoft.AspNet.EntityDataSource.EntityDataSource) this.FindDataSourceControl();
            RegularExpressionValidator1.ValidationExpression = "";
            ds.ContextCreated += (_, ctxCreatedEventArg) => ObjectContext = ctxCreatedEventArg.Context;

            // This field template is used both for Editing and Inserting
            ds.Updating  += ds_Updating;
            ds.Inserting += ds_Updating;
            var control = this.FindControl("GridView1");
        }
コード例 #3
0
        protected void DetailGridView_Init(object sender, EventArgs e)
        {
            //   string detailTableName = DynamicDataRouteHandler.GetRequestContext(this.Context).RouteData.Values["details"].ToString();
            MetaTable table = DynamicDataRouteHandler.GetRequestMetaTable(Context);

            //       var parents = detailTable.Columns.OfType<MetaForeignKeyColumn>().Select(s => s.ParentTable).Distinct();
            //     var children = detailTable.Columns.OfType<MetaChildrenColumn>().Select(s => s.ChildTable).Distinct();
            //   var detailschildren = children.Where(x => x.Attributes[typeof(Modiriat_Gharardadha.Helpers.DetailTableName)] != null); //get child from custom attributes
            Helpers.DetailTableName tblName = table.Attributes[typeof(Helpers.DetailTableName)] as Helpers.DetailTableName;

            MetaModel model = ((DynamicDataRouteHandler)(DynamicDataRouteHandler.GetRequestContext(this.Context).RouteData.RouteHandler)).Model;

            Microsoft.AspNet.EntityDataSource.EntityDataSource GridDetailDataSource = (Microsoft.AspNet.EntityDataSource.EntityDataSource)((sender as RadGrid).NamingContainer).FindControl("GridDetailDataSource");
            GridDetailDataSource.ContextTypeName = table.DataContextType.ToString();
            if (tblName != null)
            {
                GridDetailDataSource.EntitySetName = tblName.TabeName;
            }
            else
            {
                ((RadGrid)sender).DataSourceID = string.Empty;
            }
        }
コード例 #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            uniqueKey = Guid.NewGuid().ToString("N");

            Type cstype            = this.GetType();
            ClientScriptManager cs = Page.ClientScript;

            //cs.RegisterStartupScript(cstype, "call", "Checked() {var combobox = $find('<%= cmbForignKeys.ClientID %>');for (var i = 0; i < combobox.get_items().get_count() ; i++) {$telerik.findElement(combobox.get_items()._array[i].get_element(), 'chk').checked = !($telerik.findElement(combobox.get_items()._array[i].get_element(), 'chk').checked);}");
            cs.RegisterStartupScript(cstype, "call", "Checked();");
            // Register for the DataSource's updating event
            Microsoft.AspNet.EntityDataSource.EntityDataSource ds = (Microsoft.AspNet.EntityDataSource.EntityDataSource) this.FindDataSourceControl();

            ds.ContextCreated += (_, ctxCreatedEventArg) => ObjectContext = ctxCreatedEventArg.Context;

            // This field template is used both for Editing and Inserting
            ds.Updating  += ds_Updating;
            ds.Inserting += ds_Updating;

            SetUpValidator(DynamicValidator2);
            SetUpValidator(CustomValidator1);

            //SetUpValidator(RequiredFieldValidator2);//cannot validate dropdowncheckboxes
        }