重複の可能性:
JavaScript で C# 関数を呼び出す
if ステートメント (if (condition) test=true else test= false )) を含む ac# 関数があります。javascript でその関数を呼び出し、そのテスト変数の結果を使用して if ステートメントを実行する方法を教えてください。
私が参照している c# ファイルは、.aspx ページのコード ビハインド (.aspx.cs) です。この .aspx ページから次の関数を呼び出す方法はありませんか。
public void write(bool complete)
{
System.IO.StreamWriter writer = new System.IO.StreamWriter(Server.MapPath("~file.txt"), true);
if (complete == true)
{
writer.WriteLine("completed");
}
else
{
writer.WriteLine("FAILED");
}
writer.Flush();
writer.Close();
writer.Dispose();
}