I have a string array. I need to display buttons based on if the selected item is in the array. I need to know how to tell the program if "(array.NOT Contains("string"))". Please can anybody help me?? Thanks in advance
My code:
List<string> activationids = new List<string>();
foreach (ModuleActivation moduleactivation in activationid)
activationids.Add(moduleactivation.ActivationID);
string gvselectActID = GridView1.SelectedRow.Cells[1].Text;
if (activationids.Contains(gvselectActID))
{
activateInsert.Visible = true;
activateUpdate.Visible = false;
deactivate.Visible = true;
}
else if (activationids."NOT" Contains(gvselectActID))
{
activateInsert.Visible = false;
activateUpdate.Visible = true;
deactivate.Visible = false;
}
else
{
activateInsert.Visible = false;
activateUpdate.Visible = false;
deactivate.Visible = false;
}
}
Change:
else if (activationids."NOT" Contains(gvselectActID))
to
else if (!activationids.Contains(gvselectActID))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With