Creating Datagrid Programatically

Discussion in 'ASP .Net Datagrid Control' started by Raja Rajan J, Jul 8, 2003.

  1. Raja Rajan J

    Raja Rajan J Guest

    Hello,

    My query is simple. That is, I want to create a datagrid with data from
    the database table and EditCommandColumn dynamically to edit, update and
    cancel.

    I have written event handlers for each of the events such as
    EditCommand, UpdateCommand and CancelCommand.

    What is happening is, the datagrid is shown properly with all the data
    from the database table and the EditCommandColumn(Edit).

    I have observed the following things.

    1. When i click on edit, the seleted row is opening in the edit mode.
    That is fine. That is, the event handler for the EditCommand is
    invoked(ItemCommand event is called properly)

    2. When I click on Update after editing the fields, the problem
    starts here. That is, the ItemCommand event is fired with

    ItemType = Item and
    CommandName = Edit

    The Actual value of the above said should be

    ItemType = EditItem and
    CommandName = Update

    Because of the wrong values being set, it is calling the event handler
    of the EditCommand again, instead of UpdateCommand event handler.

    3. When I click on Cancel button, the ItemCommand event itself is not
    fired.

    The Actual value when ItemCommand is fired should have been the
    following

    ItemType = EditItem and
    CommandName = Cancel

    Since the ItemCommand event itself is not fired when Cancel
    button is clicked, nothing is happening.

    Note : The above said problems (2 and 3) is happening only when datagrid
    is created programatically at runtime but not when designed at design
    time.


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Raja Rajan J, Jul 8, 2003
    #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. Hrvoje Vrbanc
    Replies:
    1
    Views:
    471
  2. Michelle Stone

    Datagrid, adding a row programatically

    Michelle Stone, Oct 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    19,802
    Saravana [MVP]
    Oct 18, 2003
  3. Fernando A. Gómez F.

    Creating a DetailsView programatically

    Fernando A. Gómez F., Nov 21, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    364
    Fernando A. Gómez F.
    Nov 21, 2008
  4. Big Daddy

    Creating a custom user control programatically

    Big Daddy, Nov 1, 2006, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    130
    Big Daddy
    Nov 2, 2006
  5. Dima
    Replies:
    0
    Views:
    151
Loading...

Share This Page