Edit

Discussion in 'ASP .Net Datagrid Control' started by Demetri, Nov 15, 2003.

  1. Demetri

    Demetri Guest

    I have a datagrid and is endowed with the edit/update/cancel buttons. I have a routine that handles the editcommand event for the datagrid, which sets the EditItemIndex to the e.Item.ItemIndex value - I then rebind the data.

    The buttons change from edit to update and cancel but the cells remain the same - no text boxes appear.

    What am I doing wrong? I need the text boxes to appear for the user to edit the information.

    Thanks
     
    Demetri, Nov 15, 2003
    #1
    1. Advertising

  2. Demetri

    Aaron Weiker Guest

    Demetri,
    It sounds like you may be using Template Columns in your datagrid. If this
    is the case you will need to make sure that you also implement the
    EditItemTemplate as well as the ItemTemplate. In order to fully implement
    the update button in the datagrid you will need to handle the UpdateCommand
    event. The MSDN documentation for this can be found here:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/htm
    l/frlrfSystemWebUIWebControlsDataGridClassUpdateCommandTopic.asp

    (Watch out for wrapping)

    Aaron Weiker
    http://aaronweiker.com/

    On Fri, 14 Nov 2003 18:26:10 -0800, Demetri wrote:

    > I have a datagrid and is endowed with the edit/update/cancel buttons. I have
    > a routine that handles the editcommand event for the datagrid, which sets
    > the EditItemIndex to the e.Item.ItemIndex value - I then rebind the data.
    >
    > The buttons change from edit to update and cancel but the cells remain the
    > same - no text boxes appear.
     
    Aaron Weiker, Nov 15, 2003
    #2
    1. Advertising

  3. Demetri

    Demetri Guest

    Actually the columns are created at runtime (auto generate). The only columns I've added with property builder is the edit/update/cancel buttons.

    In a previous application I wrote - all I had to do was set the EditItemIndex to be 0 or greater and the grid generated the textboxes for me. The only difference in that application to this one is the fact that I did create bound columns in it. So I'm wondering if that is what is limiting me now.
     
    Demetri, Nov 15, 2003
    #3
  4. Demetri

    Demetri Guest

    I added a bound column and voila when I go into edit mode the textbox appears for that column but the other (auto generated) columns don't have that luxury

    Is there a way around this? What I have is a droplist with table names and when a user selects one the sql statement selects all rows from the selected table and then I bind a datareader to the grids datasource and call the grids databind method. In otherwords I dont know what the field names will be in design time in order to make bound columns in design time
     
    Demetri, Nov 15, 2003
    #4
    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. San Diego Guy
    Replies:
    0
    Views:
    549
    San Diego Guy
    Aug 7, 2003
  2. Schultz
    Replies:
    3
    Views:
    565
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  3. =?Utf-8?B?a2Vu?=
    Replies:
    1
    Views:
    10,337
    Wiktor Zychla [C# MVP]
    Jan 23, 2006
  4. Sharon McCarty
    Replies:
    0
    Views:
    252
    Sharon McCarty
    Nov 24, 2004
  5. Frank Kurka
    Replies:
    8
    Views:
    311
Loading...

Share This Page