Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2004

Tip: Looking for answers? Try searching our database.

How to show popup message in a webform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ipsita - 13 Nov 2004 18:06 GMT
Hi,

I am explaining the scenario of what I am trying to do:
- I have a webform with some controls, from which I am taking the
data. eg say Username, password
- I am passing these data as parameters to the web service method
result = serviceproxy.VerifyUser(username, password) on the event of
the "Submit" button_click.
- The webservice webmethod uses the username, password to verify if
the user is valid user. If no, it sends an error message to the client
say "Invalid Username" which gets stored in the variable "result" as
shown above.
- I need to show this message stored in variable "result" in a popup
box on the client side. And when the user clicks "OK" on the popup box
he can continue further.

In my button_Click method I am doing the following:
string strScript, result;
Client.proxy serviceproxy = new Client.proxy();
result = serviceproxy.VerifyUser(username, password) ;
strScript = "<script language=JavaScript>alert('" & result &
"')</script>";

I am stuck now..I dont know what exactly to do. Do I need to add
something to the html file?

Can anyone tell me the way to do this? Please let me know.

Thanks and Regards
Ipsita
Ipsita - 15 Nov 2004 02:38 GMT
Hi!

I was able to show a message as an alert. On the client side I used:
Label1.Text = "<script language=JavaScript>alert('Hello');</script>";

The value 'Hello' shows in the pop up alert.

Next phase of the problem is that instead of showing a fixed message
ie 'Hello' in the alert, if I wanted to show the contents of a string
variable, how do I do it?
eg string strMessage = "Excellent";
Label1.Text = "<script language=JavaScript>alert('" & strMessage &
"');</script>";  ----------> this shows compilation error

Please let me know how to show the value of the variable in the pop
up. I am using webform and C# in ASP.NET.

Thanks and Regards
> Hi,
>
[quoted text clipped - 26 lines]
> Thanks and Regards
> Ipsita
Derek Harmon - 15 Nov 2004 03:14 GMT
> if I wanted to show the contents of a string variable, how do I do it?
> eg string strMessage = "Excellent";
[quoted text clipped - 3 lines]
> Please let me know how to show the value of the variable in the pop
> up. I am using webform and C# in ASP.NET.

Visual Basic uses & to concatenate strings (this is the reason the C# compiler
gives you an error).  In C#, use +.

   Label1.Text = "<script language=JavaScript>alert('" + strMessage + "');</script>";

Derek Harmon

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.