Pass webcontrol into class

Discussion in 'ASP .Net Web Controls' started by Paul, Mar 10, 2007.

  1. Paul

    Paul Guest

    Hi all,

    I have a set of dynamically built objects (built based on saved
    preferences) which are loaded into a placeholder on page load. Each
    object controls and populates a webcontrol. I'm currently looking at
    the best way to save the data in these controls on a save button being
    clicked. Because a control can be any kind of webcontrol, I was
    considdering passing the control itself (or even the placeholder) into
    it's object class and then being able to manipulate it there and save
    the data. An alternative is to inherit each object class from page and
    pull the data out that way - but that way seems to add a lot more size
    to the obects. eg:
    //interface is used to call load, save, update etc on a list<T> of
    different objects

    public class someName : iSomeObject
    {
    private int objectRef;
    private PlaceHolder placeholder;

    someObject(int _id, ref PlaceHolder _PlaceHolder)
    {
    objectRef = _id;
    placeholder = _PlaceHolder;
    loadObj();
    }

    void loadObj()
    {
    //use datalayer to accessdb on objRef and pull out data
    //create new webcontrol of correct type + populate with db
    data
    //place webcontrol into placeholder
    }

    void saveObject()
    {
    //use placeholder and get object
    //pullout webcontrol data
    //pass data to datalayer to be saved in db

    }
    }

    Is this a feasible way of doing this?
    Paul, Mar 10, 2007
    #1
    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. Guest
    Replies:
    2
    Views:
    729
  2. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    193
    Luis Ramírez
    Jul 6, 2004
  3. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    181
    Kasabaarde Sumta
    Dec 13, 2004
  4. Fabricio

    Custom webcontrol that references another webcontrol

    Fabricio, Sep 21, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    175
    Fabricio
    Sep 21, 2005
  5. Peter Morris [Air Software Ltd]

    WebControl with non-WebControl property

    Peter Morris [Air Software Ltd], Dec 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    129
    Peter Morris [Air Software Ltd]
    Dec 7, 2004
Loading...

Share This Page