Editing only certain items.

E

eagle

How do I set dynamically which items I want to edit when I go into Edit
mode. The code below puts the entire row into Edit mode. The user has 2
buttons, one button uses the code below to edit the entire row, but the
other button wants to allow only certain fields to be editable, with the
other fields displayed but not in edit mode. How can I do this?

Dim dv As DataView
dv = ds.Tables(0).DefaultView

dgrid.EditItemIndex = e.Item.ItemIndex

dgrid.DataSource = dv

dgrid.DataBind()
 
E

Elton Wang

One way is to set some fields un-enabled:

e.Item.Cells(col_index).Enabled = False
HTH
 
E

eagle

That works great for all fields except the drop down lists. If I don't
populate the drop down list, nothing shows up at all. Any ideas how I
disable the drop down list? Thanks for your help.
 
E

Elton Wang

How about after populating the drop down list, then disable it.

ddl.Enabled = False

HTH
 
E

eagle

I tried that too, but something else is either refreshing the data or I'm
missing the order of events. I ended up creating hidden columns that would
display the ddl's value as a text, then just toggle the columns depending on
what the user is doing. That works just fine.

Thanks for your help.

Thanks for your help.
 

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,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top