Beginner Looking For Help

Discussion in 'ASP .Net Building Controls' started by cmay, Apr 18, 2005.

  1. cmay

    cmay Guest

    I am looking for some help with this problem I am experiencing.

    What I want to do, is extend the dataset, but include a button above it that
    I can click, and handle the postback of that click w/ in my custom server
    control code.

    So, my class inherits from the dataset, and has a button defined within it
    at the class level.

    I found that if wrote out the button with:
    then the postback would not be caught.

    However, if I add the button to the controls collection like:

    then the click event is caught.

    However, I want to be able to place my button in a specific location,
    basically with the following HTML:


    I am able to do this easily when I render the control with the
    HTMLTextWriter (which seems to turn off the ability to catch the button click
    event), but I don't see a way to do it w/ the method of adding the button to
    the controls collection.

    So, can anyone tell me, what methodology I need to follow in order to extend
    the datagrid to add a button, but also keep the ability to put the button
    where I want it in the custom control heirarchy?
    cmay, Apr 18, 2005
    1. Advertisements

  2. cmay

    Matt Guest

    Are you implementing the INamingContainer interface? And have you
    tried overriding CreateChildControls() instead of worrying about
    Matt, Apr 19, 2005
    1. Advertisements

  3. cmay

    cmay Guest

    The short answer to your questions are:
    1) No
    2) No

    I guess that establishes that I am not going about this the right way.
    Do you know of any examples out there that use the
    INamingContainer/CreateChildControls to achieve what I am looking for?
    A quick google search turned up a lot about creating template controls,
    but that doesn't seem to be what I want.

    I'm guessing that if I were to override the createChildcontrols, I
    wouldn't inherit from the datagrid but rather add a datagrid to my
    control via the CreatechildControls?

    If I were to still inherit from the datagrid, and I used the
    CreateChildControls, where would those controls endup in relation to
    the datagrid itself?
    cmay, Apr 21, 2005
    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.