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. Collection Editor Problem

Collection Editor Problem

Scheduled Pinned Locked Moved ASP.NET
helpdatabasedesign
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
    Ujjaval Modi
    wrote on last edited by
    #1

    i have made one double type collection editor in web control library project. the collection gets displayed properly at design time and i am able to add and remove items also but my problem is that value entered at design time does not effect the control at runtime. Here's the code : First of all I designed a class for creating a List Collection : using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace Funnel { public class SectionValue : CollectionBase { public double this[int index] { get { return ((double)List[index]); } set { List[index] = value; } } public int Add(double value) { return (List.Add(value)); } public int Add(string value) { try { double c = Convert.ToDouble(value); return (List.Add(c)); } catch (Exception) { throw new ArgumentException(string.Format( "Error converting the given string '{0}' to a color", value), "value"); } } public bool Contains(double value) { // If value is not of type Color, this will return false. return (List.Contains(value)); } public int IndexOf(double value) { return (List.IndexOf(value)); } public void Insert(int index, double value) { List.Insert(index, value); } public void Remove(double value) { List.Remove(value); } public SectionValue(double[] sections) : base() { foreach (double s in sections) { this.Add(s); } } public SectionValue() : base() {} } } Then I use object of the class in my control as follows : protected SectionValue m_SectionValue; and write property for it as follows : [Bindable(true) , Category("Appearance") , Browsable(true) , PersistenceMode(PersistenceMode.Attribute) , DesignerSerializationVisibility(DesignerSerializationVisibility.Content) ] public SectionValue UserDefinedSection { get { if (m_SectionValue == null) m_SectionValue = new SectionValue(); return m_SectionValue; } set { m_SectionValue = value; } } Now this code is working perfectly regarding displaying the collection editor and add/deleting values from it. Even I am able to :)add/delete values from code-behind. But the values added during design time do not get reflected at run-time. If I assign values to collection from code-behind file then the values get reflected at run-time but not from design-time. Thanks & Regards, Ujjaval Modi.

    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