Preventing page from going back to parent page after clicking on pop up Ok button in classic asp - page-refresh

i have written following code for pop up :
function OpenApproveLevelPopup() {
// debugger;
//document.frmopportunity.txtopplvl.value = 'Level2';
var url = 'ApprovePopUp_shilpa.asp?opprApprLvl=' + document.frmopportunity.txtopplvl.value;
//+ document.frmopportunity.txtopplvl.value;
var windowRetVal = window.showModalDialog(url, "", "dialogHeight:150px;dialogWidth:280px;status: No;");
document.frmopportunity.txtopplvl.value = windowRetVal;
//TheForm.
return windowRetVal;
}
and i am calling this function on click of a button using following code:
<TD><INPUT class=standard type=submit value='Change Opportunity Design Level' name=ChangeOpportunityDesignLevel onclick = ' return OpenApproveLevelPopup()' ></TD></TR>"
After clicking on OK button in pop up ,my page is getting refreshed and it is going back to Parent page,i dnt want this.Please help me reatining the same even after clicking on OK button.

Related

How to disable menu button press in TVML?

How to disable menu button press in TVML? For some scenarions in my project,like while playing Ads in video, I dont want user to skip it by pressing menu button.I did not see any solution on internet. Please help.
function loadingDoc() {
var Template = `
<document>
<divTemplate>
<title style="tv-position: bottom-right;">1/1</title>
</divTemplate>
</document>`
var templateParser = new DOMParser();
parsedTemplate = templateParser.parseFromString(Template, "application/xml");
parsedTemplate.addEventListener("disappear", highlightThumbnail.bind(this));
player.interactiveOverlayDocument = parsedTemplate;
player.interactiveOverlayDismissable = true;
}
var highlightThumbnail = function (event){
loadingDoc();
}
Two solutions that might work are:
1) Native + TVML: find the topmost view controller as mentioned in iPhone -- How to find topmost view controller and apply UITapGestureRecognizer to it.
2) TVML only: with interactiveOverlayDismissable and interactiveOverlayDocument, you can push another overlay document when the user dismisses the current one. Thus-- they will never be able to menu out.

How do I set the title for the back button on a Nav Bar in Xamarin.Forms?

I have to remove the title on the back button in several pages. I tried with this code and it works fine.
private void OnBtn ()
{
var nav = (Page)ViewFactory.CreatePage<DebugViewModel, DebugPage> ();
NavigationPage.SetHasNavigationBar (nav, true);
NavigationPage.SetHasBackButton (nav, true);
NavigationPage.SetBackButtonTitle (nav, "");
((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync (nav);
}
But in some other place of the code I have this and it doesn't set the title to an empty string.
this.SettingsPageCommand = new Command (() => {
this.IsBusy = true;
NavigationPage.SetHasNavigationBar (settingsPage, true);
NavigationPage.SetHasBackButton (settingsPage, true);
NavigationPage.SetBackButtonTitle(settingsPage, "");
((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync (settingsPage);
//((MasterDetailPage)App.Current.MainPage).IsPresented = false;
this.IsBusy = false;
}, () => !this.IsBusy);
I'm trying to avoid making a renderer as I want to keep as much shared code as possible.
Any ideas?
Thanks!
#hrishi's answer is correct, however if you wish to have different text shown in the Title Bar (this.Title) than shown for the Back button text on subsequent pages you can alternatively call the following method. You would call this in the constructor for the page whose title should be different on the back button:
NavigationPage.SetBackButtonTitle(this, "CustomText");
Typically I only set Title unless it needs to be different when shown for back button (ex: shorter text) in which case I set both Title and call the above method with the alternative back button text.
Title property of content page is used on next page as title of back button.
Try Setting this.Title="" on previous page of settings page

Can't open Telerik Kendo window twice

I have a Kendo window which is defined as follows:
With Html.Kendo().Window().Name("tranferwindow")
.Title("Select Transfer Destination")
.Content("")
.Resizable()
.Modal(True)
.Events(Function(events) events.Open("WindowToCenter"))
.Events(Function(events) events.Refresh("transferopen"))
.Draggable()
.Width(400)
.Visible(False)
.Render()
End With
The window is opened each time by using the refresh and passing a new URL.This is to allow dynamic data to be displayed dependent on what the user clicked on a grid.
function transferitem(e) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
wwindow.data("kendoWindow").open(); //Display waiting window while refresh happens
var twindow = $("#tranferwindow")
twindow.data("kendoWindow").refresh('/Home/TransferList?agentid=' + agentid + '&tenantid=' + tenantid + '&SessionID=' + dataItem.MediaID);
}
The Window is opened at the end of the refresh event to make sure the user doesn't see the previous content.
function transferopen() {
wwindow.data("kendoWindow").close(); //Close the 'wait' window
var twindow = $("#tranferwindow")
twindow.data("kendoWindow").center().open();
}
This all works well and the window can be closed and reopened as often as I like.
However I needed to access the resize event of the window from within the Partial View to resize the Grid which is inside the window. To achieve this I added the following to the partial view that is returned from the url.
$("#tranferwindow").kendoWindow({
resize: function (e) {
// resizeGrid();
}
});
Adding this event mapping causes the issue where I cannot open the Window more than once.
I assume I need to 'unregister' for the event somehow before closing?
Found a solution: much cleaner and no VB Razor needed :)
I changed the approach to create a new window each time I wanted to display one.
I created a div to hold the Window.
<div id="windowcontainer"></div>
Then when the user selected a command on the grid , I create the whole window appending it to the div. The key here is the this.destroy in the deactivate event.
function transferitem(e) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
$("#windowcontainer").append("<div id='tranferwindow'></div>");
var mywindow = $("#tranferwindow")
.kendoWindow({
width: "400px",
title: "Select Transfer Destination",
visible: false,
content: '/Home/TransferList?agentid=' + agentid + '&tenantid=' + tenantid + '&SessionID=' + dataItem.MediaID,
deactivate: function () {
this.destroy();
},
open: WindowToCenter,
refresh:transferopen
}).data("kendoWindow");
mywindow.refresh();
}
Then on the refresh function
function transferopen() {
var twindow = $("#tranferwindow")
twindow.data("kendoWindow").center().open();
}
Now I can have the event binding inside the Partial View which works fine and the window can be re opened as many times as I want. :)
Update: Adding the event binding inside the Partial View stops 'Modal' from working. Working on trying to fix this...

how to get text of kendo editor text in button click

I am using Kendo UI editor for my project (MVC 4 application).
In the button click event I need to display the editor text in another div once user enters the text and clicks on the preview button.
How do I do this?
Try this:
function getClick(e) {
try { //the name of your editor
var editor = $("#editor").data("kendoEditor");
var editorContent = editor.value();
alert(editorContent);
//Do Your stuff here
}
catch (e) { }
}
then call with a button
<button class="k-button" id="btnPreviewContent" onclick="getClick()">PreviewEditor Content</button>

GLOBAL loading inside each single button with Jquery in ajax calls of asp.net mvc

I have the following scenario:
I have a button\link with a image inside like this:
<button type="submit" id="myButton" class="button"><img src="../../Content/images/check.png" id="defaultImage" />
SaveData!!!</button>
We are OK here! Now what I need to do is:
I want on the click that the image change for a loading element that is previously loaded in the page like this:
<img id="loadingImage" src="../../Content/images/loader.gif" style="display: none;" alt="loading"/>
And then when the load complete turn back the old button image, I ended with this code:
function loader() {
var $button = $('#myButton');
if (btnState == '1') {
$button.find('img').hide();
$button.prepend($('#loadingImage'));
$('#loadingImage').css({ 'display': 'inherit' });
btnState = '0';
}
else {
$button.find('img').hide();
$button.prepend($('#defaultImage'));
$('#defaultImage').show();
btnState = '1';
}
}
This does the trick for ONE SINGLE button(since I pass its ID in the function) but, when I have for example a grid with a button on each line, I found inviable when managing a screen with many buttons do this for each of then. The main question is: How can I make this method general for all buttons/links on one specific class in the page?
The goal is: Click a button, get the image and change it and stop(can be manual). I just don't wanna have to Hook ALL buttons.
You should do something like this, it will prevent the user from double submitting:
$('.button').click(function(evt) {
evt.preventDefault();
var button = this;
hideButton(button);
$('ID or CLASS').load('AJAX FILE URL', function() {
//On success, show button remove image
showButton(button);
});
});
function hideButton(button) {
$(button).hide().after('<img src="../../Content/images/loader.gif" alt="loading"/>');
}
function showButton(button) {
$(button).next('img').hide();
$(button).show();
}
All of the code above should be in the $(document).load
Your HTML should look like:
<button type="submit" class="button"><img src="../../Content/images/check.png" />SaveData!!!</button>
There is no need for Id's now on anything.

Resources