DataGrid must be Bound before Editing

Discussion in 'ASP .Net' started by =?Utf-8?B?TXJNaWtl?=, Mar 10, 2005.

  1. I have a sub named Bind("") which binds my a datagrid on my webform. In
    order to enter edit mode and edit records on this datagrid, I must make a
    call to Bind("") either before or after I place the DataGrid into edit mode.
    For example, DataGrid.EditCommand looks like this ...

    DataGrid1.EditItemIndex = e.Item.ItemIndex
    Bind("")

    Without having the Bind("") call within the EditCommand, an exception occurs
    saying something to the extent of..."Failed to enable viewstate...".

    The problem with including a call to Bind("") within the EditCommand is that
    if there is a sort applied to my datagrid at the time the user enters 'Edit'
    mode, the datagrid removes the sort, applying the original sort that it
    possesses at load time, and the incorrect record is placed in EDIT mode. How
    can I work around this?

    Thanks.
    =?Utf-8?B?TXJNaWtl?=, Mar 10, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?TXJNaWtl?=

    Elton Wang Guest

    Hi Mr. Mike,

    Yesterday, somebody asked similar question in group
    dotnet.framework.aspnet.datagrid, Subject: DataGrid sort
    when Editing, you can read the Q & A. If you think the
    answer is not you want, please let us know.

    HTH

    Elton Wang



    >-----Original Message-----
    >I have a sub named Bind("") which binds my a datagrid on

    my webform. In
    >order to enter edit mode and edit records on this

    datagrid, I must make a
    >call to Bind("") either before or after I place the

    DataGrid into edit mode.
    >For example, DataGrid.EditCommand looks like this ...
    >
    >DataGrid1.EditItemIndex = e.Item.ItemIndex
    >Bind("")
    >
    >Without having the Bind("") call within the EditCommand,

    an exception occurs
    >saying something to the extent of..."Failed to enable

    viewstate...".
    >
    >The problem with including a call to Bind("") within the

    EditCommand is that
    >if there is a sort applied to my datagrid at the time the

    user enters 'Edit'
    >mode, the datagrid removes the sort, applying the

    original sort that it
    >possesses at load time, and the incorrect record is

    placed in EDIT mode. How
    >can I work around this?
    >
    >Thanks.
    >.
    >
    Elton Wang, Mar 10, 2005
    #2
    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. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,215
    thushara wijeratna
    Oct 7, 2008
  2. Rhiner Dan
    Replies:
    1
    Views:
    738
    Mike Wahler
    Mar 27, 2005
  3. Mario Krsnic
    Replies:
    0
    Views:
    368
    Mario Krsnic
    Jun 23, 2006
  4. Phillip Vong
    Replies:
    0
    Views:
    410
    Phillip Vong
    Jul 27, 2006
  5. HP
    Replies:
    0
    Views:
    425
Loading...

Share This Page