Dear all,
I am very new with ASP.NET .. how to create client side's message box? .. please help
TIA
Regards
Winanjaya
Printable View
Dear all,
I am very new with ASP.NET .. how to create client side's message box? .. please help
TIA
Regards
Winanjaya
use javascript. basically, use an alert function within the body of the page itself.
Of course, there are many places you'd use it. Like the onClick event of a button, or page load event, etc.Code:
<script language="JavaScript">
alert('Hello Cruel World!');
</script>
So there is no ASP.NET code for doing this? ..
please advise
Regards
Winanjaya
It depends. Where and when do you want this shown?
I want to show it at client side.. any idea?
thanks
VB Code:
Button1.Attributes.Add("onClick", "javascript:alert('Hello');")
Or make it a call to an existing function.
Where should I put them? .. in Page_load or what? .. please advise .. sorry I am very new with this..
thanks a lot in advance
Sure, put it in page load. That vb.net code above adds this:
<input type="button" value="Click me!" onClick="javascript:alert('hello');>
hi,
you could do a little futher on that, you could do it in an event doing something like this
dim sScript as string="<script language=javascript>"
sScript +="alert(""" your message variable or otherwise """");"
sScript +="</script>"
If not Page.IsStartupScriptRegistered("nameofyourscript") then
page.registerstartupscript("nameofyourscript",sScript)
end if
end sub
Just be aware that when you try to find the isstartupscriptregistered and the registerstartupscript with the inteligicence you wouldn't find then so you have to type them all
Hope this helps a little bit more
Ben