Child Controls and Event Handlers

Discussion in 'ASP .Net Web Controls' started by Stickley, Nov 26, 2003.

  1. Stickley

    Stickley Guest

    I have a web form containing 2 design time controls, a
    datagrid (myDatagrid) and a Table (myTable). At runtime I
    bind the Datagrid to a dataset. I also loop through an
    additional dataset and add columns to the table, each
    column contains a LinkButton. I attach an event handler
    do the LinkButtons using the following command.

    theLinkButton.Command += new CommandEventHandler

    If I run the page like I've just described everything
    works fine. When I click the HyperText of the LinkButton
    the DoPostBack command triggers and passes back whatever
    it passes back and the My_command function is called.

    Here is the problem I'm having: For my DataGrid, I've
    attached a function to the OnItemDataBound event which
    fires for each row as it is bound to the Dataset. Based
    on a specific value in one of the datagrid cells, I
    attach myTable to the specific cell using the following


    Visually this is working, myTable no longer appears on
    the main page but is now in the cell I've attached it to.
    The problem is the MyCommand event is no longer triggered
    when I click on the Hyperlink for the LinkButton. I can
    see that there is a difference between the __doPostBack()
    javascript function but I do not understand how to
    overcome the problem.

    Can anyone help me understand what I need to do to get
    the Event handler working when the myTable object is
    attached as a child object to myDataGrid.

    Thanks for your help,
    Stickley, Nov 26, 2003
    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.