Thanks for replying, but
I have no idea which value to assign to CommandArgument. I guess it needs
the index of the selected row ...
On Feb 13, 3:51 pm, "Bart" <b...@b.d> wrote:
> Hi,
>
[quoted text clipped - 34 lines]
> End Select
> End Sub
Because you did not assign any values to CommandArgument, and by
default it's String.Empty, which cannot be converted to an Int16.
gnewsgroup - 13 Feb 2008 22:12 GMT
> Thanks for replying, but
>
[quoted text clipped - 46 lines]
>
> - Show quoted text -
So, you would like to have the row index? Can you do the following?
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="AddButton" runat="server"
CommandName="AddToCart"
CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
Text="Add to Cart" />
</ItemTemplate>
</asp:TemplateField>
It should work for a LinkButton, too.