How to dynamically enable/disable row editing in GridView control (ASP.NET 2.0) ?

Discussion in 'ASP .Net' started by misiek, Feb 28, 2006.

  1. misiek

    misiek Guest

    Hi all.

    I would like to know if it is possible to dynamically enable/disable
    row editing in GridView control in ASP.NET 2.0. I am asking because
    this feature should be enabled/disable depending on button, which was
    clicked by user.

    Thanks in advance,
    misiek
    misiek, Feb 28, 2006
    #1
    1. Advertising

  2. Misiek,

    You can put a row in edit mode with:

    GridView1.EditIndex

    EditIndex gets or sets the row to edit.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "misiek" <> wrote in message
    news:...
    > Hi all.
    >
    > I would like to know if it is possible to dynamically enable/disable
    > row editing in GridView control in ASP.NET 2.0. I am asking because
    > this feature should be enabled/disable depending on button, which was
    > clicked by user.
    >
    > Thanks in advance,
    > misiek
    >
    S. Justin Gengo [MCP], Feb 28, 2006
    #2
    1. Advertising

  3. misiek

    misiek Guest

    Justin, I know that.

    What I meant was not to enable editing of certain row in GridView, but
    enabling/disabling Edit button, which is used for editing.
    I use standard Edit button from designer. I would like it to be visible
    only in certain circumstances.

    Do you know how it can be done?

    misiek
    misiek, Feb 28, 2006
    #3
  4. misiek

    misiek Guest

    Anybody?
    misiek, Mar 3, 2006
    #4
  5. misiek

    carl Guest

    There are a number of ways to do this. If you just want to remove the
    button from a row, you can use:

    row.Cells[0].Controls.Clear();

    Assuming that your edit button is in the first column. You can also
    convert it to a TemplateColumn and hide it like you would any control
    in a grid.

    -Carl
    carl, Mar 3, 2006
    #5
  6. misiek

    misiek Guest

    Thanks carl.

    I did it in such way: GridViewPI.Columns[1].Visible = false;
    misiek, Mar 4, 2006
    #6
  7. misiek

    umeshdchaudhari

    Joined:
    May 30, 2007
    Messages:
    1

    You can do run time using rowbound event for hole row:

    e.Row.Enabled = False
    umeshdchaudhari, May 30, 2007
    #7
  8. misiek

    Sri123

    Joined:
    Apr 8, 2011
    Messages:
    1
    Thanks For solving

    Thanks Carl i can Use this solve the issue

    But When i run the app then javascript error has been displayed 'Object is required'

    for inserting this comment row.Cells[0].Controls.Clear();

    Could u give me any solution to solve the issue .

    Regards

    Sriram.V
    Sri123, Apr 8, 2011
    #8
    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. K B
    Replies:
    1
    Views:
    3,495
    Craig Deelsnyder
    Apr 19, 2006
  2. Mel
    Replies:
    1
    Views:
    1,127
    Larry Bud
    Jul 30, 2007
  3. =?Utf-8?B?Z3V5?=

    GridView -enable editing

    =?Utf-8?B?Z3V5?=, Oct 30, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    1,125
    =?Utf-8?B?Z3V5?=
    Oct 30, 2007
  4. Andrew Jocelyn
    Replies:
    2
    Views:
    1,516
    Allen Chen [MSFT]
    Apr 27, 2009
  5. ashan

    How to enable and disable a single row in a datagrid?

    ashan, Jul 22, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    125
    Eliyahu Goldin
    Jul 23, 2006
Loading...

Share This Page