473,569 Members | 2,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to show popup message in a webform

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.Ve rifyUser(userna me, 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.Ve rifyUser(userna me, password) ;
strScript = "<script language=JavaSc ript>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
Nov 18 '05 #1
3 3956
Your button click is a server side event, so the output of this needs to be
an alert actioned in the onload of the resulting page.

--
Regards

John Timney
ASP.NET MVP

"Ipsita" <ip************ @gmail.com> wrote in message
news:ef******** *************** **@posting.goog le.com...
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.Ve rifyUser(userna me, 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.Ve rifyUser(userna me, password) ;
strScript = "<script language=JavaSc ript>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

Nov 18 '05 #2
Hi!

I was able to show a message as an alert. On the client side I used:
Label1.Text = "<script language=JavaSc ript>alert('Hel lo');</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=JavaSc ript>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
Ipsita

"John Timney \(ASP.NET MVP\)" <ti*****@despam med.com> wrote in message news:<ex******* *******@tk2msft ngp13.phx.gbl>. ..
Your button click is a server side event, so the output of this needs to be
an alert actioned in the onload of the resulting page.

--
Regards

John Timney
ASP.NET MVP

"Ipsita" <ip************ @gmail.com> wrote in message
news:ef******** *************** **@posting.goog le.com...
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.Ve rifyUser(userna me, 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.Ve rifyUser(userna me, password) ;
strScript = "<script language=JavaSc ript>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

Nov 18 '05 #3
What I think you may be looking for is the following (watch out for word
wrap):

string message = "Excellent! ";
Page.RegisterSt artupScript("Lo gonResults", "<script
language=JavaSc ript>alert('" + message + "');</script>");

The compilation error you would have gotten with your example below is
that & is a concatenation character in VB/VB.Net but not in C#. You
would need to use the + sign.

There are many Register type methods for the Page object that can be
used to send script to the client, so this may not be the one you want
but it will show the message box as soon as the page loads.

If you were to apply this to your original code block you would get
(again watch for word wrap):

string strScript, result;
Client.proxy serviceproxy = new Client.proxy();
result = serviceproxy.Ve rifyUser(userna me, password) ;
strScript = "<script language=JavaSc ript>alert('" + result + "')</script>";
Page.RegisterSt artupScript("Lo gonResults", strScript);

Hope that helps.

Have A Better One!

John M Deal, MCP
Necessity Software
Ipsita wrote:
Hi!

I was able to show a message as an alert. On the client side I used:
Label1.Text = "<script language=JavaSc ript>alert('Hel lo');</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=JavaSc ript>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
Ipsita

"John Timney \(ASP.NET MVP\)" <ti*****@despam med.com> wrote in message news:<ex******* *******@tk2msft ngp13.phx.gbl>. ..
Your button click is a server side event, so the output of this needs to be
an alert actioned in the onload of the resulting page.

--
Regards

John Timney
ASP.NET MVP

"Ipsita" <ip************ @gmail.com> wrote in message
news:ef****** *************** ****@posting.go ogle.com...
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.Ve rifyUser(userna me, 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.pro xy serviceproxy = new Client.proxy();
result = serviceproxy.Ve rifyUser(userna me, password) ;
strScript = "<script language=JavaSc ript>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

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1778
by: Steve Westwood | last post by:
I have a WebForm button. Depending on calculation I wont to send a popup message to the web page. I am not sure of the approach. From the server side code I don't seem to be able to access the client side script. Can anyone help? I am using the VS .net C# environment
9
2275
by: trint | last post by:
Ok, How can I NOT show the "titlebar" or the "border" at all on a webform (I have a transparent gif as the edges)? Thanks, Trint
1
1432
by: Thierry | last post by:
Hi, I want to make a calendar popup in ASP.net, but how can I get a selected date from my popup to the textbox on my webform? I use a Calendar component in my popup and I can't get the selected date in the textbox on my (main) webform. Thanks, Thierry
1
1632
by: mg | last post by:
I want to disable a TextBox in the WebForm that opens a popup Webform ... from the popup WebForm. The following javascript code doesn't work: window.opener.document.getElementById("TextBox1").Enabled = false; What am I doing wrong? Could you provide a solution?
2
2066
by: tao lin | last post by:
Hi, all I am using VS2003 under WinXP. My WebApp has a WebForm which has a html form has some search condition textbox, once the user fill in the condition and click submit button. My app will stay in the same WebForm but open a popup window in the browser to show the search results. So I implement like this: private void...
1
3488
by: Matt Jensen | last post by:
Howdy I've got a ASP.NET webform page that pops up a window for a user to make a selection. Once they make a selection in this popup window, the form in the popup is submitted an update to the DB is fired, the window closes, and the opener window's (server) form is submitted (via JavaScript) (so that any form changes that were made are...
1
2107
by: VMI | last post by:
How can I transfer some text from a Textbox in a popup window to the main webform that opened that popup? The popup webform will have some type of Button that the user will click in order to accept those changes. This is where the transter of the value should be. It could also be done when I close the popup form (whichever is easier). Once...
5
1728
by: VMI | last post by:
How can I pass variable or Property values from my popup webForm to the webform that opened this popup? For information that's in a control (i.e. Textbox), I'm using javascript and document.getElementById: var variable = document.getElementById('txtBox).value; But if the control is hidden, that javascript code generates an error. Can...
2
2374
by: ruca | last post by:
Hi, Can anyone tell me please how can I return values from a popup to a UserControl. I use the same "method" like to return to a WebForm, but it not works in UserControl case. I have this code to return from popup to webform: ------------------------------------------------------------------------ sbScript.Append("<script...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.