Editing data

E

et

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?
 
T

Teemu Keiski

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)
 
K

KatMagic

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.
 
T

Teemu Keiski

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top