a project for control??

Discussion in 'ASP .Net Building Controls' started by rua17, Nov 17, 2003.

  1. rua17

    rua17 Guest

    I want to create a library of my custom controls, can I create a lot of
    controls in one project or I need one project per control?
     
    rua17, Nov 17, 2003
    #1
    1. Advertisements

  2. rua17

    Chris Bower Guest

    You can put all of your controls into one project and have it compile down
    to a single assembly. You can then add that assembly to your toolbox, etc so
    you can Drag & Drop your custom controls from the toolbox.
     
    Chris Bower, Nov 17, 2003
    #2
    1. Advertisements

  3. rua17

    rua17 Guest

    thanks.

    I'm trying to create a control that inherits from button Class, if I choose
    add user control, a control container appears, how can I only have the
    button control on the screen??
     
    rua17, Nov 17, 2003
    #3
  4. rua17

    Chris Bower Guest

    Hmm, can you paste your inherited code? If you're creating a class like this
    (VB syntax):

    Public Class myButton
    Inherits Button
    ....
    End Class

    It should display just fine. Are you overriding the Render method or
    anything?
     
    Chris Bower, Nov 17, 2003
    #4
  5. rua17

    rua17 Guest

    I did something like this
    I create a new project ->new class library

    I put this code in c#

    public class command_std:Button

    {

    ....

    }



    I clicked the command_std Preview and it tells me:



    To add components....



    what am I doing wrong???

    As I tell you before if I chose new project .> user control library, a
    container appears



    thanks
     
    rua17, Nov 17, 2003
    #5
  6. rua17

    Chris Bower Guest

    Ohh, I see what you mean. When you're building a control like that (by
    adding a class library), you (at least as far as I'm aware of) can't design
    the control as such. If you're going to inherit from the Button class and
    you want to add extra elements, you'll have to do it manually in your code.
    The best way to do this is in the CreateChildControls method. You can also
    override the Render and RenderChildren methods, etc.
     
    Chris Bower, Nov 17, 2003
    #6
  7. rua17

    rua17 Guest

    thanks a lot...



     
    rua17, Nov 17, 2003
    #7
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.