locked
Nested classes properties, property editor RRS feed

  • Question

  • i have a user control with following structure, i want to when i add it to form, and clicked in class's properties a property editor shows for entering sub properties. or something like that.

    my class structure:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    
    public class a : System.Web.UI.UserControl
    {
      b p1 = new b();
    
      public b P1
      {
        get { return p1; }
        set { p1 = value; }
      }
    
      c p2 = new c();
    
      public c P2
      {
        get { return p2; }
        set { p2 = value; }
      }
    
    }
    
    public class b
    {
      int p1;
      public int P1
      {
        get { return p1; }
        set { p1 = value; }
      }
    
      d p2;
      public d P2
      {
        get { return p2; }
        set { p2 = value; }
      }
    }
    
    public class d
    {
      string s;
      public string S
      {
        get { return s; }
        set { s = value; }
      }
    }
    
    public class c
    {
      //....
    }
    

    • Moved by Cookie Luo Wednesday, December 29, 2010 9:24 AM (From:.NET Base Class Library)
    Sunday, December 26, 2010 4:32 PM

Answers

All replies

  • Hi Zarei Ramin

    Base on your description, you would like to use a UserControl to add own class structure in asp.net. Right?

    You should create a WebUserControl. And copy your code into this WebUserControl class. I have done a test for that already. Please try.

    Best Regards,

     


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 29, 2010 7:42 AM
  • Hi Cookie Luo.

    Yes, i want when user adds usercontrol to his form he can, modify properties of usercontrol. however my usercontrol properties isn't primitive data types (int string ,...), i.e  properties have their properties.

    I want something like gridview EditRowStyle Properties.

    tanks.

    Wednesday, December 29, 2010 7:54 AM
  • Hi

    ASP.net problems are not supported in our forum. Please visit http://forums.asp.net to post this thread.

    Best Regards,


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 29, 2010 9:24 AM
  • I' mean like it. not gridview.

    i example it because it's properties is nested like i want.

    Wednesday, December 29, 2010 9:45 AM
  • Hi

    Yes, I know it is not a gridview. your class inherits  System.Web.UI.UserControl. You can gain better solution in http://forums.asp.net.


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Zarei Ramin Friday, December 31, 2010 9:05 PM
    Thursday, December 30, 2010 3:13 AM