|
-
Jan 18th, 2008, 12:34 PM
#1
Thread Starter
Hyperactive Member
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!!!
-
Jan 18th, 2008, 01:02 PM
#2
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
-
Jan 20th, 2008, 09:02 AM
#3
Re: java alert
You can always use
Code:
Response.Write("<script>alert(\"Error\");</script>");
But I wouldn't recommend that
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jan 26th, 2008, 04:59 AM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|