I'm trying to disable a specific hyperlink on a gridview.. however I'm still new to windows form and don't know how to do it.

Here's my code:

   void gvStockTransferDetails_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
        GridViewRowInfo row = gvStockTransferDetails.CurrentRow;
        ItemDetailValidationModel m = row.DataBoundItem as ItemDetailValidationModel;
        if (e.Column.Name == "LotValue")
        {
            if (!m.IsLotItem)
            {
                //disable hyperlink
                e.Cancel = true;
            }
        }

        if (e.Column.Name == "ExpiryDate")
        {
            if (!m.IsExpiring)
            {
                e.Cancel = true;
            }
        }
    }

I can disable the expirydate by doing e.cancel = true.however I can I prevent the click event on the hyperlink?enter image description here

Related posts

Recent Viewed