-
java alert
This can't be that hard but I can't seem to find a way to do it... I have googled several different ideas to no avail. this is what I need to do.
I have an ASP.NET Page with a button - Of course the code behind is C#. When the user clicks the button I want check if there are any selected items (that is no problem) if there aren't any selected items I need to pop up and alert - that tells them this...
Can someone point me in the right direction on this? I would think it would be simple but I can't find anything that shows how to conditionally call a java alert - or some sort of alert...
Thanks!!!
-
Re: java alert
You can't pop-up a client-side alert from the server. You'll either need to write the JavaScript yourself so it'll pop-up on the client side (post-backs to check if items are selected is a waste of time anyway) or you can use the ASP.Net Ajax components to get the job done as per: http://forums.asp.net/p/1055457/1502283.aspx#1502283
-
Re: java alert
You can always use
Code:
Response.Write("<script>alert(\"Error\");</script>");
But I wouldn't recommend that
-
Re: java alert
Use Page.RegisterStartupScript or ClientScript.RegisterStartupScript to pass your <script> and alert() through, ComputerJy wouldn't use Response.Write because it's bad practice (writing to the output stream...er... mid stream).
Also, it's javascript, not java, big difference.