私のaspxページにボタンがあります。私はそのボタンをクリックして実行を続行する前にjavascriptの確認を使用したい。私はaspxページ自体にjavascriptを書いているなら、簡単にそれを行うことができます。しかし、私の問題は、確認メッセージが異なる可能性があるたびにです。適切な確認メッセージを生成するために、さまざまな条件を確認する必要があります。JavaScriptをC#のコードの背後にあるコードで確認します。
私のコードの中でconfirmをコールすることができますので、そこから確認メッセージを作成できますか?
私は何をしようとしていることである:
protected void Button1_Click(object sender, EventArgs e)
{
//just the algorithm given here
string message=constructMessage(); \\ its just a function to construct the confirm message
if(confirm(message)) // i know i cant use javascript in code behind direct. How can i do this
{
//do something
}
else
{
// do nothing
}
}
が完了しました。お返事ありがとうございました。 –
[call js confirm from code behind]の複製が可能です。(http://stackoverflow.com/questions/1491210/call-js-confirm-from-code-behind) –