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 Properties

Custom Properties

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
3 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.
  • D Offline
    D Offline
    Dirso
    wrote on last edited by
    #1

    Hi, I created a TextBox derivated class and I'd like to link it to a Label using a property, so here is what I need: 1) Create a property editor that shows a list of all available labels in the Page 2) Using the labels name, I need to get the UniqueID (ClientID), so I can use it with javascript. Any tutorials about that? Thanks, Dirso.

    D 1 Reply Last reply
    0
    • D Dirso

      Hi, I created a TextBox derivated class and I'd like to link it to a Label using a property, so here is what I need: 1) Create a property editor that shows a list of all available labels in the Page 2) Using the labels name, I need to get the UniqueID (ClientID), so I can use it with javascript. Any tutorials about that? Thanks, Dirso.

      D Offline
      D Offline
      Dirso
      wrote on last edited by
      #2

      hi, Here is the code I've got so far, the ListBox works fine, but how do I populate it with the Labels? I can't access the Page object from it, right?

      internal class LabelSelectTypeEditor : UITypeEditor
      {
          public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
          {
              return UITypeEditorEditStyle.DropDown;
          }
      
          public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
          {
              IWindowsFormsEditorService srv = null;
              if (provider != null)
                  srv = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
      
              if (srv != null)
              {
                  System.Windows.Forms.ListBox lb = new System.Windows.Forms.ListBox();
                  //foreach(Control c in Pa
                  lb.Items.Add("test1");
                  lb.Items.Add("test2");
                  srv.DropDownControl(lb);
                  return lb.Text;
              }
      
              return value;
          }
      }
      

      Thanks, Dirso

      D 1 Reply Last reply
      0
      • D Dirso

        hi, Here is the code I've got so far, the ListBox works fine, but how do I populate it with the Labels? I can't access the Page object from it, right?

        internal class LabelSelectTypeEditor : UITypeEditor
        {
            public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
            {
                return UITypeEditorEditStyle.DropDown;
            }
        
            public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                IWindowsFormsEditorService srv = null;
                if (provider != null)
                    srv = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
        
                if (srv != null)
                {
                    System.Windows.Forms.ListBox lb = new System.Windows.Forms.ListBox();
                    //foreach(Control c in Pa
                    lb.Items.Add("test1");
                    lb.Items.Add("test2");
                    srv.DropDownControl(lb);
                    return lb.Text;
                }
        
                return value;
            }
        }
        

        Thanks, Dirso

        D Offline
        D Offline
        Dirso
        wrote on last edited by
        #3

        My goal is to create a property editor like the one available for the Label's AssociatedControlID.

        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