using properties

Discussion in 'ASP .Net Building Controls' started by Jon Paal, Mar 14, 2006.

  1. Jon   Paal

    Jon Paal Guest

    the primary use of a custom control is achieved with :

    "<cc1:myCustomControl id="CustomControl1" runat="server" />"

    properties are assigned programatically with a call to "LoadProperties(CustomControl1)"

    Sub LoadProperties(oThis)
    othis.Chart_align = "center"
    ...
    End Sub


    and this part works.


    When I create a second instance of my custom crontrol, and try to access a single function of that control, it tells me the
    properties don't exist.

    how can I access a single function of my custom server control to return an interim value ?


    .............. code start ...

    'create a new instance of control
    '-----------------------------------
    Dim oDisplay as myCustomControl = New myCustomControl
    call LoadProperties(oDisplay )

    'create new arraylist
    '--------------------------
    Dim myArrayList As New ArrayList()

    'populate arraylist
    '-----------------------
    myArrayList = oDisplay.buildarraylist()

    ............. end code .....

    This fails because it's not accepting the properties, but it does accept them on the first instance above ??

    ------------- error msg -----------------
    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 1415: writer.AddAttribute("align", Chart_align.ToString() )
     
    Jon Paal, Mar 14, 2006
    #1
    1. Advertising

  2. Jon   Paal

    Guest

    Just a shot in the dark but what happens when you pass in the control
    to LoadProperties() *by reference*.
     
    , Mar 16, 2006
    #2
    1. Advertising

  3. Jon   Paal

    Jon Paal Guest

    found my problem, it was in the sequence of properties being passed.

    thanks for replying.


    <> wrote in message news:...
    > Just a shot in the dark but what happens when you pass in the control
    > to LoadProperties() *by reference*.
    >
     
    Jon Paal, Mar 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    0
    Views:
    923
    Nathan Sokalski
    Oct 17, 2005
  2. =?Utf-8?B?Q2hyaXN0b3BoZSBQZWlsbGV0?=

    CompositeControls: ViewState properties w/ Mapped properties probl

    =?Utf-8?B?Q2hyaXN0b3BoZSBQZWlsbGV0?=, Jan 19, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,143
    Steven Cheng[MSFT]
    Jan 19, 2006
  3. Kent Lichty
    Replies:
    0
    Views:
    838
    Kent Lichty
    Apr 16, 2004
  4. Victor Porton
    Replies:
    1
    Views:
    703
    Steven T. Hatton
    Aug 29, 2004
  5. Sonal
    Replies:
    3
    Views:
    674
Loading...

Share This Page