@foreach (var item in outcode)
{
var outc = item;
if (!codedata.Contains(outc))
{
codedata.Add(outc);
}
else
{
Fun();
}
}
//this is my C# code and here else condition call JavaScript function.
function fun() {
$("table").append('<tr><th><button class="btn btn-secondary" type="button">@Session["dd"]</button> </th> </tr>');
}
// this is JavaScript function. and this function call when else condition execute in razor code.