How to impliment a jquery dialog window that acts as the windows message box? - asp.net

I am implementing a jquery dialog which acts as the windows message dialog in asp.net.I want to build a dialog in jquery which should wait until the user send the confirmation and the asp.net code execution should stop unless until I click on the confirmation box with ok and cancel button.How I can implement this dialog. I am using the ScriptManager.RegisterStartupScript in the code window in asp.net.I removed the default message confirmation window of asp.net.I want to build the same message window with jquery...
Is it possible?

Why can't you use "confirm" function that is part of javascript ?
Look on this example:
...script type="text/javascript"...
function confirmation() {
var answer = confirm("Leave http://stackoverflow.com?")
if (answer){
alert("Bye bye!")
window.location = "http://stackoverflow.com";
}
else{
alert("Thanks for sticking around!")
}
}
.../script...
may be this example helps you.

Related

Google-chat: Open dialog on Button Click

I post simple message with cards_v2. I placed a Button with properties:
action: {
function = "myAction",
interaction = "OPEN_DIALOG"
}
When I click on button I receive event but no DialogEventType is provided.
I tried to reply with Dialog payload, but Google says bad response.
I used this: https://developers.google.com/chat/how-tos/dialogs?hl=en#apps-script
Dialog buttons works only if I send a response on message. When I posted cards through API POST it doesn't work.
I can't say is this a bug of Feature.

Keyboard shortcut for MVC application

How can we use Keyboard shortcut for MVC application?. My requirement is when I press Ctrl+U , I want to load my home page and when I press Ctrl+T, nedd to open another page. How it is possible in client side.
Please help.
Regards
Sreyas MN
Capture the Events via Javascript.
KeyCode for Ctrl+U and Ctrl+ T using below code
$(document).bind('Keydown',function(event){
if(event.KeyCode== Keycode) // check for Keycode for Ctrl+U and Ctrl+ T
{
window.location.href(url);
}
});
use target="_blank" to open in new tab.
Just capture keyboard events on client script, when your desired key combinations fire redirect your code execution to the desired controllers with location.href
You can use jquery hotkeys
jQuery Hotkeys supporting almost any key combination.
$(document).bind('keydown', 'Ctrl+T', function(){
// Do what ever youwant
});

ajax window while executing code in the background asp.net

I have a three pages form in which I need to collect data.
While transferring from one page to another I would like to display ajax window which will say, for example, "saving your data", and while that is shown on the screen I would like to run a code in the background?
Try this way.
While saving data call the ajax model popup on the click event and initialize the thread in the init event of popup window and once the work is done, close the popup window.
Model Popup will also disable the other control on the page using background css.
public void SimpleWork()
{
//Do something
}
Now you use either this method
ThreadStart operation = new ThreadStart(SimpleWork);
Thread theThread = new Thread(Operation);
theThread.Start();
or
ThreadPool.QueueUserWorkItem(delegate{SimpleWork();});
If you find it useful, Mark it as your answer else let me know..

How to embed "Share on Facebook" button into Flex application?

I'm trying to duplicate the behaviour of the "Share on Facebook" button from Youtube. Basically, inside a Flex app I'll have a button and when I click it I want a popup that enables me to post something on the wall.
While it is possible to make a call to javascript to open the pop-up I want to be able to set the images and the text of my posting.
Do you know how I could set the images or text as a paramter to the sharer window?
Thank you!
This is fairly straightforward to do. Youtube uses the Facebook API which pops up a new window (Info on Facebook sharer API).
To do this in flex,
Create a button that onClick will call a javascript method, ExternalInterface.call("fbLink", "www.yahoo.com");
In your HTML file (most likely index.template.html) add the JavaScript method, fbLink which does the following:
function fbLink(url) {
window.popup("http://www.facebook.com/sharer.php?u=" + url, {height:440, width:620, scrollbars:true})
}
Now when a user clicks on the button they will be sharing the link "yahoo.com" with facebook account.
as I understood you asking for some help in accessing js popup in html page of facebook share button, so you should use ExternalInterface in this casa and access needed DOM node using getElementById function in your js interface.
In other case I want propose you to read another one way http://www.riaxe.com/blog/flex/publish-into-facebook-wall-from-flex/
It seems that you want to have a button on the flash application and once clicked it opens the facebook page that shares the video/image that pertains to the clicked button. What you want to do is simply create a button that on click opens a new website to facebook using their share api which has the following format:
var facebookShare:String = "http://www.facebook.com/share.php?u=' + encodedVideoLink + '&t='+ encodedVideoText";
Where the u parameter stands for the link that you wish to share, and the t parameter stands for the title of the piece that you want to share, whether it be a picture or video.
You want to add an event listener on MouseEvent.CLICK that has as its callback function a method that handles the opening of the facebook page passing the facebookShare variable as shown above. To open another page on your browser you can use this AS3 Class called URLNavigator: http://www.danishmetal.dk/project/source/com/zorked/URLNavigator.as
To sum it up, something along these lines would do:
var facebookShare:String = "http://www.facebook.com/share.php?u=' + encodedVideoLink + '&t='+ encodedVideoText";
facebookButton.addEventListener(MouseEvent.CLICK, this._goToUrl(facebookShare));
private function _goToUrl(link:String):Function {
var window:String = "_blank",
feats = "",
thisOverlay:Object = this; // to not lose scope when returning a func
return function (e:MouseEvent):void {
trace("Opening link to:"+link);
try { URLNavigator.ChangePage(link, window, feats); }
catch (e:Error) { trace("error launching "+link+" in "+window+" with feature set "+feats); }
}
}
I hope that helps. If you have questions regarding the code please let me know.

Does ASP.NET have the equivalent of VB's InputBox function?

VB has a function InputBox() that will prompt the user to enter a single value, then click OK.
Is there a parallel functionality in ASP.NET, that will get the browser to pop up some kind of input box to return a single value?
If not, how do you recommend I achieve this effect?
You can do this in JavaScript
var result = prompt("Question", "Default text");
document.getElementById("HiddenInputBox").value = result;
document.HiddenForm.submit();
But most web apps seem to use of screen forms and simulated modal dialogs (fade and disable rest of screen)
jQuery is your friend for this, try simplemodal
For more functionality, check out the asp.net ajax control toolkit, and specifically the modal popup box control.
http://www.asp.net/ajax/
Yes - use the prompt() javascript function.
var x = prompt("enter a value");

Resources