>>Now for some reason the previously working correctly code doesn't work anymore:
>
>Set the command argument to "RemUser".
>
>
> protected void grdvwUsers_RowDataBound(object sender, GridViewRowEventArgs e)
> {
> if (e.Row.DataItem != null)
> {
> LinkButton link = e.Row.FindControl("lnkbtnRemoveRole") as LinkButton;
> if (link != null)
> {
> link.CommandArgument = "RemUser";
>
>
>
>>Do you know why does it affect the other code and how can I have them both working? Or what code should I use when I click on the Remove User button (originally it was not a linkbutton).
>
>Different controls have different properties. Since you're probably not setting the CommandArgument in the ASPX page anymore, you need to set them in the code-behind.
I'm setting it in ASPX. My code in RowCommand does go to RemUser, but it gives an error on
int index = Convert.ToInt32(args.CommandArgument);
line.
If it's not broken, fix it until it is.
My Blog