Re: link data grid edit button

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



itemIndex = -1 means ListItemType.Header.

So you have to use

If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
ListItemType.Item = ListItemType.AlternatingItem Then

rather than

If e.Item.ItemType = ListItemType.Item OrElse ListItemType.AlternatingItem
Then

That condition will bypass Header, Footer, Separator, Pager items.

HTH

Elton







"John M" wrote:

> Ignore the last,
>
> I found it (itemIndex = -1, and that's why controls.count = 0),
> so I add in the code :
> If e.Item.ItemIndex <> -1 Then ...
>
> Another thing is that I see that the page is refreshing (page_load event
> occurs),
> but the command editBtn.Attributes.Add("Onclick", "Alert('Edit Message')")
> is not doing anything.
> (There is no message box).
> Why ?
>
> Thanks :)
>
>
>
.


Quantcast