I know how to this when a button is clicked. For example:
imgBtnDelete.Attributes.Add("onclick", "return confirm('Please confirm you want to delete the letter')")
My question is:
Say I have a piece of code-behind not related to clicking,calculating the value of a boolean, and if the boolean is true then I want the message box with ok/cancel to appear.
f.e.:
bool hasMoney = ...
if (hasMoney)
{
\\message box..
}
How do I do it?
You can do something like this:
And change the JS there to suit.
So call that function from a server side event.
Edit, much better explanation than me here