Client side message box

hello,

 I have a message box that pops out on the click of a button, asking what is the next step. If the user chooses Yes the application opens a word document to write, and if it clicks No just a read-only word document.

I use this code

DialogResult reply = MessageBox.Show(text, "Files", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

if (reply == DialogResult.Yes)

{if (exst.Equals(".doc")) openword( dest, "yes");}}

else if (reply==DialogResult.No)

{if (exst.Equals(".doc")) openword ( dest, "no");}

 

when I run this code in Localhost it works ok, but when I do publish on my VS2005 project to a server and start the page from there

it gives this error :D

System.InvalidOperationException:Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation.Specify the ServiceNotification or DefaultDesktopOnly style to displaya notification from a service application.

what is the problem? any help?

thank u,

Probi

0
Probi
8/4/2008 4:53:22 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

5 Replies
1242 Views

Similar Articles

[PageSpeed] 59
Get it on Google Play
Get it on Apple App Store

 you cannot use dialog result and messagbox in the web environment.To display something similar you ought to be using javascript

javascript confirm will provide you with a way to pop open a dialog box. However you are bound to run into issues since you want to open a word document. Remember that anything that runs in the browser has limited privileges so you won't be able to open a word doc on the client side


Jeev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
0
Jeev
8/4/2008 5:09:52 PM

Probi:

hello,

 I have a message box that pops out on the click of a button, asking what is the next step. If the user chooses Yes the application opens a word document to write, and if it clicks No just a read-only word document.

I use this code

DialogResult reply = MessageBox.Show(text, "Files", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

if (reply == DialogResult.Yes)

{if (exst.Equals(".doc")) openword( dest, "yes");}} else if (reply==DialogResult.No)

{if (exst.Equals(".doc")) openword ( dest, "no");}

 

when I run this code in Localhost it works ok, but when I do publish on my VS2005 project to a server and start the page from there

it gives this error :D

System.InvalidOperationException:Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation.Specify the ServiceNotification or DefaultDesktopOnly style to displaya notification from a service application.

what is the problem? any help?

thank u,

Probi

 

Welcome to the web application world!!

Alexei Cioina.

http://www.californiadreamhomesandland.com/Pages/ReportExplorer.aspx?ItmPath_25B7ED104E83=/English/Web%20Master/Web%20Site%20Statistics


Alexei Cioina
0
cioina
8/4/2008 6:22:57 PM

 Hi,

This will only work on your local dev machine is .NET is server side technology. To give a popup to the user on a published website, use a client side technology i.e. javascript.

The javascript code you need to display the popup is  

alert("my message here");
HTH

 


Regards,

Tony.

Please mark this post as Answered if my comment helped you, thanks.
0
Metalore
8/4/2008 6:26:03 PM

I have been trying for some time to make sence of the alert vs confirm options and how to put all that in my code

the buttons are created in code behind, I need a gialouge box with yes and no and to get the answer to proceed with the next step

I got so messed up in all sorts of posts for javascript, alert, confirm and so on, and I never used this before so any help will be great

 thanks a lot,

Probi

0
Probi
8/5/2008 1:30:57 PM

Once you get a reference to your button, you can use Attributes.Add("onclick", "alert('Test')");

Here is some sample

string PersonName = view["FirstName"].ToString() + " " + view["LastName"].ToString(); //e.Row.Cells[5].Text + " " + e.Row.Cells[6].Text;

ImageButton btnDelete = (ImageButton)e.Row.Cells[1].Controls[0];

ImageButton btnEdit = (ImageButton)e.Row.Cells[0].Controls[0];

if (btnDelete != null)

{

btnDelete.ToolTip =
"Delete " + PersonName;

btnDelete.Attributes.Add("onClick",

"var ch=confirm('Do you want to delete " +

PersonName + "?');if(ch==false) return false;");

}

 


Beware of bugs in the above code; I have only proved it correct, not tried it.
(Donald Knuth)
0
Naom
8/5/2008 2:27:30 PM
Reply:

Similar Artilces:

client-side message box...
I looked into putting a messagebox that alerts you whether or not you really want to delete it. I just put a simplistic button with the code in the subpage like it called for in the example, just a simple button click test and I am getting the error: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30456: 'BtnDelete' is not a member of 'ASP.test_aspx'.Source Error: Line 9: Private Sub ...

displaying client side message box
i want to dispaly the system.Windows.Forms.MessageBox in the client side computer.. i try this code but when i excute it, i is displaying in server not in the client computer how am i going to do this. thanks in advance What kind of application are we talking about? Where is the code located? BrianBrian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4). like this im using asp.net i want to execute asp.net function. ex. public sub save() ...

How to display message box at client side?
hi there, Can any body help me out to display a message box in asp.net. If so pls send me how to do it. It may be easy but I want to know how . thanks Regards, DeadRocker I use this function: public void ClientMessageBox( string message ) { Page.RegisterStartupScript( "alert", "<script>alert('" + message + "');</script>" ); } Niall...

getting value from client-side prompt box
hi, i'm having problem getting value from prompt box. Here's the logic of my Login application. User logs in, when button clicked -- subroutine Login will be fired. if user is Late in his working hour, sub routine check_late will be fired and it creates a client-side script dynamically. a prompt box will not be closed by any keys except when u fill-out the reason for being late. then after that, how do i get the value of it back to my .net application? Help anyone? i'm quite desperate on this. thanx guys :) '// if button login clicked Sub Login(Sender As ...

get the changed value of a text box
Hello everybody! I have this in the server side: <asp:textbox id="TEscala" runat="server"></asp:textbox> <asp:imagebutton id="BIrEscala" runtat="server" imageurl="images/irmapa.gif"> </asp:imagebutton> And i want to do this: Private Sub BIrEscala_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles BIrEscala.Click Dim xx As String xx = Tescala.value End Sub The problem is that "xx" doesn´t get the new value written in the ...

Problems showing a message box after postback at client side
I'm going topost this topic again because in the previous post I think that I didn't explain you exactly what my problem is. I have an asp:Button named "cmdGuardarMACJunta", when I click on this button, the "OnClick" event at the code behind of my page is: Protected Sub cmdGuardarMACJunta_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGuardarMACJunta.Click    ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "conf", "confirmar('Are you sure?');", True)End Sub In the client script ...

Getting Value from Client-side InputBox to .net variable
hi, im doing a login page for our timekeeping. Since there's no msgbox available on asp.net, im doing it dynamically via javascript. How do i Get the value frm a dynamically written javascript (such as inputbox) to a .net variable? here's the logic of my program, user logs in hits the button and sub-routine Login will be fired, if user is late -- call Check_Late Sub, this is whre the client-side script was built -- then after that i wanted to be able to get the value from an inputbox. '// if button login clicked Sub Login(Sender As Object, E As EventArgs) .......

"Push" messages to Atlas/Ajax Client or Client-side event handling of server messages
What I'm looking for is the ability for the client-side Ajax/Atlas GUI to be able to update itself when events occur on the server. The issue is that the events are triggered from a third party, and aren't triggered by postback. For example, let's say there's a Queue of data on the server, and each time a new item is added to the Queue, I want the client to recognize the addition and display the new item. Right now, the only way I can think of doing this is by setting up an Ajax timer and checking the state of the Queue on every timer tick. While this doesn't cause the page to refresh/postba...

Edit control based on client side message box choice
I have a dropdownlist and was wondering that if after a selection is made, would it be possible to have a message box appear with yes/no values. if yes is clicked a textbox value is 1 if no is clicked the textbox gets a 0.  Then, a code is run, the code has a slight variation if the yes was click or the no was clicked.  Thanks. -Matt mfscheetz:I have a dropdownlist and was wondering that if after a selection is made, would it be possible to have a message box appear with yes/no values. if yes is clicked a textbox value is 1 if no is clicked the textbox gets a 0. You c...

How I can show Message Box in ASPX page on client side
HII I want to show a client side message box for (validations) in aspx page... I am using private void btnAddGL_Click(object sender, System.EventArgs e) { if(some checking......) { RegisterClientScriptBlock("msgNotEqual","<script>alert('Sorry!! Your Total Debt and Credit are not equal.')</script>"); } else { //do all work here } } This message box shows when I click on my botton and it post backs page..... But i want to show message on Client Side.... Please tell my how i can show a mess...

how to get value from client side script Prompt window to a session var in .net
hi guyz, i hav a problem with getting a value from a client-side inputbox to a session var in .net. is this possible? however, when i click submit button this is the code that's triggered. dim sb as New System.Text.StringBuilder sb.append("<script language=" & """" & "vbscript" & """" & ">") sb.append(vbcrlf) sb.append(vbcrlf) sb.append("do while xLate =" & """" & """") sb.append(vbcrlf) '//prompt window, val...

Why the added Client Side Message Box to ASPX Pages always cause POST BACK?
Hi,          I met a problem is about message box added on the button. No matter I clicked OK or Cancel, even I clicked X to close the pop up dialog, the page always post back. It seems that confirmation dialog doesn’t work.          I use web visual developer 2005 express. The code I use to test was:         <form id="form1" runat="server">     <div>         <asp:Button ID="Button1" runat="server" Text="Click Me" /&...

Server-side or client-side loading message?
I want to add this basic functionality of ajax, which is a loading message while the server is doing something.I could use a client-side control, like a div. But then I'd have the problem of hiding the div after a certain method was finished. I could use registerclientscript, but then I think it is weird to activate the message with client code and deactivate in the code-behind.I'd like to control the show and hide on the server side. How can I do that? When I click a button, I'd have to fire two assynchronous events, one to show the message and the other to do whatever it does...So I want t...

Getting my client-side variable over to server-side
Ok so I have looked at a few posts on this subject and I can't quite figure out how to apply the idea to what I am doing here. I am using javascript to take amounts from 7 different textboxes and add them up on the fly, dropping the total in the 8th textbox. After they fill in that information they click button (postback) to continue throughout the form... what I need is for the "textboxTotalAmt" to move from client-side to server-side.  So I can access that total amount later in the form. Here is the Javascript piece... <script type="text/java...

Web resources about - Client side message box - asp.net.getting-started

Message - Wikipedia, the free encyclopedia
A message is a discrete unit of communication intended by the source for consumption by some recipient or group of recipients. A message may ...

Some Pebble smartwatch owners can now reply to text messages on the watch – but there are catches
Pebble smartwatches just got a little smarter, allowing some iPhone owners to reply to text messages directly on the watch – something that has ...

WhatsApp gets starred messages, rich preview links and more in latest update
WhatsApp, one of the most popular mobile messaging services on Android, is getting quite the handful of useful features in its latest update. ...

Viber now lets you attach files, delete messages and more
Viber continues to bring handy updates that make the app even more vibrant all the time. From the addition of sticker packs and link previews ...

AT&T, Verizon try to prevent ban on text message blocking
(credit: Intel Free Press ) AT&T, Verizon, and other wireless carriers are urging the Federal Communications Commission to reject a petition ...

Tom Brady Sends Thanksgiving Message Fulfilling Fan’s Final Wish
Jaclyn Spotts, 23, has been in critical care at Beth Israel Medical Center in Boston. On November 22, her sister Natalie said in a Facebook post ...

Hollande's message to Obama: This is an emergency
A French official tells CBS News that Francois Hollande will tell Obama the threat from ISIS requires urgent action

After Paris attacks, the message Obama wants climate summit to send
Nearly 150 world leaders are gathering for the climate summit in Paris just two weeks after the terrorist attacks there. The meeting is now about ...

The Messages The US Dropped On ISIS Are Chilling
The Messages The US Dropped On ISIS Are Chilling

Broadcast Networks Kick Off Thanksgiving Programming With Obama Message: Keep Calm, Carry On
Big 4 broadcast networks joined their cable news brethren in carrying President Obama ’s short Thanksgiving-eve statement to a jittery public ...

Resources last updated: 11/29/2015 2:42:57 AM