Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Custom Control TreeWeb and DataBinding

Custom Control TreeWeb and DataBinding

Scheduled Pinned Locked Moved ASP.NET
helpwpfwcf
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    uadrive
    wrote on last edited by
    #1

    I have written a modification to the TreeWeb custom control found here on The Code Project. I needed to be able to bind data to any TreeElement that I choose. I have been able to do this by making the TreeElements controls themselves and using a ControlDesigner to allow me to make DataSource Selections to the properties. The issue I am having is that I can set the DataSource initially, but once I build, or close my project and try to open the page that has a TreeWeb, the DataSource is no longer editable through the properties. Instead it will be greyed out displaying 'System.Data.DataSet' as the value in the field. The other issue I'm having is when I bind the control in Page_Load it sees a filled DataSource as empty unless I reset the DataSource just before binding. Any help would be appreciated. I intend to post the source when I'm completed to help The Code Project out. Thanks. Here's the designer code from my designer related to DataSource // resolve ambiguous reference public string DataMember { get { Check.Require(this.mElement.DataMember != null); return this.mElement.DataMember; } set { this.mElement.DataMember = value; this.OnDataSourceChanged(); } } public string DataSource { get { DataBinding binding = base.DataBindings["DataSource"]; if(binding != null) { return binding.Expression; } return string.Empty; } set { // check to see if it needs to remove dataSource if((value == null) || (value.Length == 0)) { base.DataBindings.Remove("DataSource"); } else { // sets a new dataSource DataBinding binding = base.DataBindings["DataSource"]; if(binding == null) { binding = new DataBinding("DataSource", typeof(IEnumerable), value); } else { binding.Expression = value; } base.DataBindings.Add(binding); } this.OnDataSourceChanged(); base.OnBindingsCollectionChanged("DataSource"); } } protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); PropertyDescriptor prop = (PropertyDescriptor)properties["DataSource"]; AttributeCollection runtimeAttributes; if(prop!=null) { runtimeAttributes = prop.Attributes; // make a copy of the original attributes but make room for one extra attribute ie the TypeConver

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups