ItemCommand not firing w/ a control in ItemTemplate column

Discussion in 'ASP .Net Datagrid Control' started by Sal, May 11, 2004.

  1. Sal

    Sal Guest

    I 've been dealing with this problem for a while now.
    I have a datagrid in which one column is a template column, encompassing
    textboxes (1 hidden, 1 visible) and bound to the same data source column.
    Also the footer contains a button to save contents of the textboxes.
    Viewstate is on.
    I also have a custom header row that I place on the grid:
    This line instantiates the custom row: Dim DGHeaderRow As New
    DataGridItem(-1, 0, ListItemType.Header)
    This line adds the custom row to the datagrid:
    DGPrtTrk.Controls(0).Controls.AddAt(0, DGHeaderRow)
    What I'm finding is that the custom row will interfere with how the template
    column's footer button works. Upon 1st click of this button, to save the
    contents of the textboxes, the page reloads but the itemcommand event
    doesn't fire. The page comes back and all of the item rows contents are
    shifted down one row, so the last item row's contents are in the footer row.
    Upon 2nd click of this button the page reloads and the itemcommand event now
    does fire. Also the gird appears how it should appear, all item rows in
    their right place.
    If I comment out the custom row code while keeping everything else the same,
    the itemcommand event fires on the first try, everytime.
    Does anyone know why this is happening or even experienced this?
    Sal
     
    Sal, May 11, 2004
    #1
    1. Advertising

  2. Sal

    Rick Spiewak Guest

    Is this new header row in addition to the existing one? I'm not sure that
    works. Why not just manipulate the contents of the existing header row.

    "Sal" <> wrote in message
    news:...
    > I 've been dealing with this problem for a while now.
    > I have a datagrid in which one column is a template column, encompassing
    > textboxes (1 hidden, 1 visible) and bound to the same data source column.
    > Also the footer contains a button to save contents of the textboxes.
    > Viewstate is on.
    > I also have a custom header row that I place on the grid:
    > This line instantiates the custom row: Dim DGHeaderRow As New
    > DataGridItem(-1, 0, ListItemType.Header)
    > This line adds the custom row to the datagrid:
    > DGPrtTrk.Controls(0).Controls.AddAt(0, DGHeaderRow)
    > What I'm finding is that the custom row will interfere with how the

    template
    > column's footer button works. Upon 1st click of this button, to save the
    > contents of the textboxes, the page reloads but the itemcommand event
    > doesn't fire. The page comes back and all of the item rows contents are
    > shifted down one row, so the last item row's contents are in the footer

    row.
    > Upon 2nd click of this button the page reloads and the itemcommand event

    now
    > does fire. Also the gird appears how it should appear, all item rows in
    > their right place.
    > If I comment out the custom row code while keeping everything else the

    same,
    > the itemcommand event fires on the first try, everytime.
    > Does anyone know why this is happening or even experienced this?
    > Sal
    >
    >
     
    Rick Spiewak, May 13, 2004
    #2
    1. Advertising

  3. Sal

    Sal Guest

    Yes this row is in addition to one already there. I need it to apply a
    label that spans 2 or more rows. Sort of a grouping if you will. The row
    def works but it interferes with itemtemplates in the grid.
    S

    "Rick Spiewak" <> wrote in message
    news:...
    > Is this new header row in addition to the existing one? I'm not sure that
    > works. Why not just manipulate the contents of the existing header row.
    >
    > "Sal" <> wrote in message
    > news:...
    > > I 've been dealing with this problem for a while now.
    > > I have a datagrid in which one column is a template column, encompassing
    > > textboxes (1 hidden, 1 visible) and bound to the same data source

    column.
    > > Also the footer contains a button to save contents of the textboxes.
    > > Viewstate is on.
    > > I also have a custom header row that I place on the grid:
    > > This line instantiates the custom row: Dim DGHeaderRow As New
    > > DataGridItem(-1, 0, ListItemType.Header)
    > > This line adds the custom row to the datagrid:
    > > DGPrtTrk.Controls(0).Controls.AddAt(0, DGHeaderRow)
    > > What I'm finding is that the custom row will interfere with how the

    > template
    > > column's footer button works. Upon 1st click of this button, to save

    the
    > > contents of the textboxes, the page reloads but the itemcommand event
    > > doesn't fire. The page comes back and all of the item rows contents are
    > > shifted down one row, so the last item row's contents are in the footer

    > row.
    > > Upon 2nd click of this button the page reloads and the itemcommand event

    > now
    > > does fire. Also the gird appears how it should appear, all item rows in
    > > their right place.
    > > If I comment out the custom row code while keeping everything else the

    > same,
    > > the itemcommand event fires on the first try, everytime.
    > > Does anyone know why this is happening or even experienced this?
    > > Sal
    > >
    > >

    >
    >
     
    Sal, May 13, 2004
    #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. EvelynAnd Ethan
    Replies:
    4
    Views:
    976
    =?Utf-8?B?Sko=?=
    Jan 9, 2006
  2. EvelynAnd Ethan
    Replies:
    0
    Views:
    401
    EvelynAnd Ethan
    Oct 17, 2005
  3. EvelynAnd Ethan
    Replies:
    0
    Views:
    547
    EvelynAnd Ethan
    Oct 17, 2005
  4. Replies:
    1
    Views:
    4,522
    Teemu Keiski
    Jul 24, 2006
  5. Mark Sisson

    What doesn't an ItemTemplate child control fire an ItemCommand??

    Mark Sisson, Dec 17, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    182
    Mark Sisson
    Dec 17, 2003
Loading...

Share This Page