disabling a textbox

P

Pkenty

How do you disable a TextBox in a datagrid in the Code
behind?
im using e.item.cells[1].Enabled = false..
But this doesnt stop the user actually typing anything in
textbox..just shows as grey?
any idea?
 
M

Marshal Antony

Hi,

((TextBox)e.Item.Cells[2].Controls[0]).Enabled=false; or
((TextBox)e.Item.Cells[2].Controls[1]).Enabled=false;

depends on the index of your textbox control on your datagrid cell.

Hope this helps.

Regards,

Marshal Antony

..NET Developer

http://www.dotnetmarshal.com
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top