Editing data

Discussion in 'ASP .Net Datagrid Control' started by et, Apr 22, 2006.

  1. et

    et Guest

    When a user clicks on the Edit button in a grid, is there a way to force
    certain fields to be blank instead of displaying the data?
     
    et, Apr 22, 2006
    #1
    1. Advertising

  2. et

    Teemu Keiski Guest

    Hi,

    I'd think that if you'd handle ItemDataBound (or RowDataBound in GridView)
    and in that check if ItemType is EditItem (in GridView RowState =
    DataControlRowState.EditRow), you could search the control(s) from the row
    and blank it yourself. (Row|ItemDataBound happens after row is being
    databound so you can affect the outcome of it at this point)

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke

    "et" <> wrote in message
    news:...
    > When a user clicks on the Edit button in a grid, is there a way to force
    > certain fields to be blank instead of displaying the data?
    >
    >
    >
    >
    >
     
    Teemu Keiski, Apr 22, 2006
    #2
    1. Advertising

  3. et

    KatMagic Guest

    I have tried this too and can't find the syntax to blank it out (I'm not on
    ASP 2.0):
    In ItemDataBound, If the itemtype = EditItem, I tried
    e.Item.Cells(7).Controls(3). ???
    There is no text or value property. I can enable it or disable it and I
    can't disable it because I want them to enter data.

    "Teemu Keiski" <> wrote in message
    news:...
    > Hi,
    >
    > I'd think that if you'd handle ItemDataBound (or RowDataBound in GridView)
    > and in that check if ItemType is EditItem (in GridView RowState =
    > DataControlRowState.EditRow), you could search the control(s) from the row
    > and blank it yourself. (Row|ItemDataBound happens after row is being
    > databound so you can affect the outcome of it at this point)
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > http://blogs.aspadvice.com/joteke
    >
    > "et" <> wrote in message
    > news:...
    >> When a user clicks on the Edit button in a grid, is there a way to force
    >> certain fields to be blank instead of displaying the data?
    >>
    >>
    >>
    >>
    >>

    >
    >
     
    KatMagic, Apr 24, 2006
    #3
  4. et

    Teemu Keiski Guest

    It's much easier to look for the control with e.Item.FindControl where you
    can look for the control with the ID. You woin't need to know the order of
    the controls in that case (and code won't break when layout changes)

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke

    "KatMagic" <> wrote in message
    news:%...
    >I have tried this too and can't find the syntax to blank it out (I'm not on
    >ASP 2.0):
    > In ItemDataBound, If the itemtype = EditItem, I tried
    > e.Item.Cells(7).Controls(3). ???
    > There is no text or value property. I can enable it or disable it and I
    > can't disable it because I want them to enter data.
    >
    > "Teemu Keiski" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I'd think that if you'd handle ItemDataBound (or RowDataBound in
    >> GridView) and in that check if ItemType is EditItem (in GridView RowState
    >> = DataControlRowState.EditRow), you could search the control(s) from the
    >> row and blank it yourself. (Row|ItemDataBound happens after row is being
    >> databound so you can affect the outcome of it at this point)
    >>
    >> --
    >> Teemu Keiski
    >> ASP.NET MVP, AspInsider
    >> Finland, EU
    >> http://blogs.aspadvice.com/joteke
    >>
    >> "et" <> wrote in message
    >> news:...
    >>> When a user clicks on the Edit button in a grid, is there a way to force
    >>> certain fields to be blank instead of displaying the data?
    >>>
    >>>
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Teemu Keiski, Apr 30, 2006
    #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. Nilay Shah

    Data Grid Editing Validation

    Nilay Shah, Jul 3, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    446
    Nilay Shah
    Jul 3, 2003
  2. Blake Versiga
    Replies:
    1
    Views:
    625
    Lewis Wang [MSFT]
    Aug 13, 2003
  3. S. Justin Gengo
    Replies:
    2
    Views:
    1,969
    Kathy Burke
    Aug 26, 2003
  4. Greg Burns
    Replies:
    1
    Views:
    378
    Greg Burns
    Oct 3, 2004
  5. Replies:
    0
    Views:
    612
Loading...

Share This Page