Here is the ASP
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="button" ButtonType="Image" ImageUrl="~/Images/lock.png" text="Lock Customer" CommandName="lock" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:ButtonField ButtonType="Image" ImageUrl="~/Images/lock_open.png" CommandName="unlock" runat="server" />
I did it two different ways based on research. The works, but I cannot get the tooltip to work.
the works, but when I press it to perform "lock" command, I get the following error:
System.FormatException: Input string was not in a correct format
Here is the cs:
Queries Q = new Queries();
string cmd = e.CommandName.ToString();
if (cmd == "unlock")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = Gridview1.Rows[index];
string arg = row.Cells[3].Text.ToString();
int c = Convert.ToInt32(arg);
Q.UpdateRecord("UPDATE [tAccounts] SET [Status] = 'Good' WHERE [contractID] = " + c);
Search();
}
if (cmd == "lock")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = Gridview1.Rows[index];
string arg = row.Cells[3].Text.ToString();
int c = Convert.ToInt32(arg);
Q.UpdateRecord("UPDATE [tAccounts] SET [Status] = 'Locked' WHERE [contractID] = " + c);
Search();
}
The line "int index = Convert.ToInt32(e.CommandArgument) ... e.CommandArgument is NULL on cmd == lock, but not on cmd == unlock.
All I want to do is add a tooltip to my buttonfield type: image.