Disabling text boxes within a data grid whilst in edit mode.

Discussion in 'ASP .Net' started by =?Utf-8?B?R2FyeQ==?=, Oct 28, 2004.

  1. Hello All,

    I have an editable data grid in my web form, this grid allows the user to
    add new records, edit existing records and also delete them. When a user adds
    a record the grid goes in to edit mode and four text boxes appear, one is for
    the start date, another for an end date and the other two are for other data,
    the user fills in the fields and saves the data, all is great at this point,
    an entry is added ok. However the problem I am having is when a user edits a
    record I do not want the start date and end date text boxes to be editable, I
    just want the standard labels to appear and not editable text boxes, but I do
    want the other two text boxes to appear.

    So, in a nutshell, I want four text boxes to be editable when a recorded is
    added, however I want only two text boxes to appear and be editable when a
    user updates a record.

    Does anyone know how I would achieve this?

    Thanks
    =?Utf-8?B?R2FyeQ==?=, Oct 28, 2004
    #1
    1. Advertising

  2. Hi Gary,

    The textbox will expose an OnDataBinding event, use this event to check
    whether the row is being added or edited and set the enabled property of the
    text box appropriately. This should do the trick.

    Thanks
    N

    "Gary" wrote:

    > Hello All,
    >
    > I have an editable data grid in my web form, this grid allows the user to
    > add new records, edit existing records and also delete them. When a user adds
    > a record the grid goes in to edit mode and four text boxes appear, one is for
    > the start date, another for an end date and the other two are for other data,
    > the user fills in the fields and saves the data, all is great at this point,
    > an entry is added ok. However the problem I am having is when a user edits a
    > record I do not want the start date and end date text boxes to be editable, I
    > just want the standard labels to appear and not editable text boxes, but I do
    > want the other two text boxes to appear.
    >
    > So, in a nutshell, I want four text boxes to be editable when a recorded is
    > added, however I want only two text boxes to appear and be editable when a
    > user updates a record.
    >
    > Does anyone know how I would achieve this?
    >
    > Thanks
    =?Utf-8?B?TmVpbA==?=, Oct 28, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?R2FyeQ==?=

    Wasi Rehman Guest

    Hi Gary,

    What you have to do is just change the ReadOnly property of your Dates
    columns to False
    If your Datagrid's AutoColumn property is true then you have to do it by
    Some Coding but if you did manually bind the column through DataGrid
    property page then you have to check ReadOnly property of Column.

    I think this help you out

    Regards,
    Wasi Rehman
    Wasi Rehman, Oct 29, 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. Ing. Rajesh Kumar
    Replies:
    2
    Views:
    360
  2. John
    Replies:
    5
    Views:
    587
    John Rivers
    Aug 25, 2005
  3. Ravi Gudlavalleti

    disabling buttons while in edit mode

    Ravi Gudlavalleti, Jun 14, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    142
    Rick Spiewak
    Jun 22, 2004
  4. Brian Watkins

    Data grid edit mode question

    Brian Watkins, Oct 19, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    93
    Brian Watkins
    Oct 22, 2004
  5. Iams

    How to edit records in a grid that's within a grid

    Iams, Mar 17, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    179
Loading...

Share This Page