Venkat, I answered this question in the
microsoft.public.framework.aspnet.datagrid newsgroup. If you are going
to post the same question to multiple newsgroups it is good netiquette
to post to all newsgroups at the same time. This way when replying, my
reply will be applied to all newsgroups.
Anywho, here was my response from the datagrid newsgroup:
======================================================
Venkat, in the ItemDataBound event you can programmatically reference
the Edit button using the following code:
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
LinkButton editButton = (LinkButton) e.Item.Cells[index].Controls[0];
// here you can set editButton.Enabled = false if some condition
holds true
}
In the above code the value for index will be the ordinal index of the
EditCommandColumn. If it's the left-most column, index would be 0, if
it's the second left-most column, then 1, and so on.
I use this technique in a number of my own projects. Hope this helps
you out as well. Happy Programming!
======================================================
[quoted text, click to view] Venkat Chellam wrote:
> I have a question.
>
> I have datagrid in asp.net page. grid will be loaded some information
> on page load. One column of the grid is editcommandcolumn type with
> edit, update and cancel options.
>
> I don't want the edit button(linktype) to be enabled for all the rows.
> Bases on some information, edit link should be enabled or disabled.
> Which is the best event to handled and any code snippets will help
>
> thank
> venky
--
Scott Mitchell
mitchell@4guysfromrolla.com
http://www.4GuysFromRolla.com