protected void Page_Init(object sender, EventArgs e) { var o = new CustomObject(); o.Properties.Add(new CustomPropertyDescriptor( "SomeString", typeof(string), null, "Hello")); o.Properties.Add(new CustomPropertyDescriptor( "SomeInt", typeof(int), new Attribute[] { new RangeAttribute(0, 100) }, 34)); o.Properties.Add(new CustomPropertyDescriptor( "SomeDate", typeof(DateTime), new Attribute[] { new DataTypeAttribute(DataType.Date) }, DateTime.Now)); DataSource1.SetDataObject(o, DetailsView1); DataSource1.Complete += new EventHandler <SimpleDynamicDataSourceCompleteEventArgs>(LinqDataSource1_Complete); }
protected void Page_Init(object sender, EventArgs e) { var o = new MyTestClass() { MyString = "Hello", MyInteger = 45, MySecondInteger = 101, MyDateTime = DateTime.Now }; DataSource1.SetDataObject(o, DetailsView1); DataSource1.Complete += new EventHandler <SimpleDynamicDataSourceCompleteEventArgs>(LinqDataSource1_Complete); }