How to dynamically enable/disable row editing in GridView control (ASP.NET 2.0) ?

M

misiek

Hi all.

I would like to know if it is possible to dynamically enable/disable
row editing in GridView control in ASP.NET 2.0. I am asking because
this feature should be enabled/disable depending on button, which was
clicked by user.

Thanks in advance,
misiek
 
S

S. Justin Gengo [MCP]

Misiek,

You can put a row in edit mode with:

GridView1.EditIndex

EditIndex gets or sets the row to edit.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
M

misiek

Justin, I know that.

What I meant was not to enable editing of certain row in GridView, but
enabling/disabling Edit button, which is used for editing.
I use standard Edit button from designer. I would like it to be visible
only in certain circumstances.

Do you know how it can be done?

misiek
 
C

carl

There are a number of ways to do this. If you just want to remove the
button from a row, you can use:

row.Cells[0].Controls.Clear();

Assuming that your edit button is in the first column. You can also
convert it to a TemplateColumn and hide it like you would any control
in a grid.

-Carl
 
Joined
Apr 8, 2011
Messages
1
Reaction score
0
Thanks For solving

There are a number of ways to do this. If you just want to remove the
button from a row, you can use:

row.Cells[0].Controls.Clear();

Assuming that your edit button is in the first column. You can also
convert it to a TemplateColumn and hide it like you would any control
in a grid.

-Carl

Thanks Carl i can Use this solve the issue

But When i run the app then javascript error has been displayed 'Object is required'

for inserting this comment row.Cells[0].Controls.Clear();

Could u give me any solution to solve the issue .

Regards

Sriram.V
 

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,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top