CommandField that varies Edit/Delete button presence per row

K

Kevin Frey

When I display a list of records in a GridView, I want to be able to vary
the presence of the Edit and Delete buttons per row depending on eg. the
user's security permissions for that row, or attributes associated with the
record (eg. a purchase order that has been dispatched to a supplier cannot
be deleted).

I figure I'm going to need a custom version of CommandField, but I'm not
sure what it's behaviour should be exactly (still coming to grips with this
separation of render versus databinding).

My instinct at this stage is I need to create the controls "in advance" and
then use visibility to turn the control invisible if the test-case (eg.
permissions) dictates it.

Should I be doing this visible/invisible switch in a data binder? Or can I
actually achieve this earlier in the InitializeCell( ) method? (and even if
that is possible, is is good practice to do so).

Thanks

Kevin
 

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,997
Messages
2,570,241
Members
46,833
Latest member
BettyeMacf

Latest Threads

Top