Server Error

G

Guest

I have problem with my studio net 2003. My web Form content a textboox and button. I want each time click button an
textbox is empty, the message will appear suc

Button Click...procedur
IF Textbox.text="" The
msgBox("textbox must be filled...",......
...
ENDI
End Button...procedu

Everytime I run the form and click the button with the empty textbox, the server error message appears such as

"It is invalid to show a modal dialog or form when the application is not running in user interactive mode..

"Specify the service notification or default desktop only style to display notification from s service application

Is there anybody Would like to help me please? I Thank 4 your kind..
 
G

Guest

It is probably not possible to display an error message in the server side code. Instead the same can be achieved using javascript as
'Server side code
Private sub Page_load(.....
Button1.attributes.add("onClick","return fnCheckEmpty()")
end sub
'javascript code
function fnCheckEmpty()
{
if (document.forms[0].TextBox1.value == ""){
alert("Textbox should not be empty");
return false;}
else
return true;
}
hope this helps!
srini
 
A

avnrao

is it web app? you should use RegisterStartupscript to show the message.

RegisterStartupScript("UniqueIDMessage","<script
language='javascript'>alert('message');</script>");

Av.
 
G

Guest

sRIni, thank 4 your answer, but I don't understand what do you mean. I think it should be possible, cause ASP.NET make it possible..but thank..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top