I'm trying to create a function that takes in a string that corresponds to an item within an enum. The following syntax works fine but I want to be able to change the ChannelType.EndUser
to use the parameter passed into the function instead, is this possible?
Here is my function:
function closeEdit(channel){
@{
var channels = Enum.GetValues(typeof(ChannelType))
.Cast<ChannelType>()
.Except(new ChannelType[] {ChannelType.EndUser});
}
@foreach (ChannelType channeltype in channels)
{
@:var buttonname = "#Cancel_" + '@(channeltype.ToString())' + "_Update";
@:if(buttonname != 'Cancel_EndUser_Update'){
@:$(buttonname).click();}
}
}