Hi,
I need to check a string contains a specific user. If user exist, need to enable button else disable it. I have used two strings. One hard coded and other taking the user name once a user logged in. And i need to check the user name in the list of hardcoded string.
here is what i have written. But its not correct.
Eg:
string username can take "xyzcom\\design.department" then the button should be shown.
- string finUser = "xyzcom\\design.department,xyzcom\\basil.jad,xyzcom\\aloshi.alex, xyzcom\\michel felx,xyzcom\\karim.hal,xyzcom\\shah shaan ";
- string username = Page.User.Identity.Name; //"xyzcom\\design.department" eg
- if (finUser.Any(username.Contains))
- {
- Button2.Visible = true;
- }
- else
- {
- Button2.Visible = false;
- }