I have an update panel in aspx page.
Click on one of the button show a div from code behind, and load to that div element from another page
ScriptManager.RegisterClientScriptBlock(this.Page, typeof(UpdatePanel), Guid.NewGuid().ToString(),
"UpsalePopup(); $('#MyDiv').load('PopUp/UpsaleAdv.aspx #UpsaleAdvPanel');"
, true);
And its working perfect.
After user close that div (have only picture)
click on asp Button to do function on server side, go to '/UpsaleAdv.aspx' and show it as 404.
Is the load() function ruin my page ? how can I prevent it or solve it ?
The page 'PopUp/UpsaleAdv.aspx' was an aspx page with <form> tag.
And after do this function:
$('#MyDiv').load('PopUp/UpsaleAdv.aspx #UpsaleAdvPanel');"
it makes the current page (myaspa.aspx) to get the funcunality from PopUp/UpsaleAdv.aspx
And once I removed the <form> tag and replaced the page to inherit from master page all works perfect.
Related
I am working with this Template from templatemo.
I wanted to include some references to other parts of the website in the body text (e.g. Please "contact me" for further information). If you click "contact me" the page should navigate to "Contact" in the same manner as if the user clicked on the navigation bar to navigate to the page (with the same animation).
In order to so, i added the following code to trigger a click event:
<p class="tm-text">Contact me via the <a id="myLink" href="javascript:loadPage(5);">contact form</a></p>
And the function to trigger the click:
function loadPage(pageNo) {
$(document).ready(function() {
$('.nav-item').get(pageNo).click();});
}
So this code is working, if I click on the reference the page changes as if I clicked the navigation bar. BUT:
If I reload the page and click on the reference, the page navigates to the contact page, which then however is not diplayed properly (the contact form and the google maps view are missing).
If I reload the page, first open the contact page via the menu, then switch to the page with the reference and click on it, the contact page is loaded properly.
This behaviour is also shown if I reference another page (e.g. the Gallery). The gallery elements are displayed (the page is not completely empty), but the spacing between the elements is not correct.
It seems like every page has to be loaded at least once via the navigation bar. If this has happened, all pages are displayed properly when opened via a reference in the text.
Thanks for your support.
Your template use Hero slider + some customs JavaScript functions to move between "pages", so you need to use the same functions to get the same behaviour.
Doing that will work:
<p class="tm-text">Contact me via the <a id="myLink" href="javascript:goToPage('Contact');">contact form</a></p>
You need to add this JS function:
function goToPage(page_name) {
// Retrieve the <a> tag with the page_name
// page_name is the string of the page in the navbar
page_link_a = $('.navbar-nav .nav-link').filter(function(index) { return $(this).text() === page_name; });
page_link_li = page_link_a.parent();
// Trigger js code from hero slider
page_link_li.click();
// Trigger js code from templatemo
page_link_a.click();
}
The function goToPage() take one parameter, the string name of the section so if you have a section named My Gallery you need to put that, not my-gallery nor an index.
I got one classic asp page and another aspx page. The classic asp page will be the parent page and the aspx page will be the child page. The child page will have a code behind page that update or add the data. The changes after any operation (update/add) will be reflected immediately at the parent page, after the child close via window.close().
I have tried to set hidden variable at the parent page and set the hidden variable at the child page and put it at body onunload event, but it seems not working.
My classic asp page:
if Request.Form="" then
if Request.Form("hidMode") = "Cr" and Request.Form("hidECardID") <> "" then
SuccessMsg = "The ECard ID template is successfully created."
end if
end if
At end of classic asp page (before form tag closing):
<input type="hidden" name="hidMode">
<input type="hidden" name="hidECardID">
My aspx page:
inside head tag:
<script type="text/javascript">
function passVal() {
winObj = window.opener
//alert(window.opener.location.href) //doesn't produce popup
eCardID =<%=hdECardID.Value%>
docMode =<%=hdMode1.Value%>
winObj.document.form1.hidECardID.value = eCardID;
winObj.document.form1.hidMode.value = docMode;
window.opener.document.form1.submit();
window.close()
}
</script>
At body tag:
<body onunload="passVal()">
I've search for answer but mostly is aspx to aspx page. I could use response.redirect, but my issue is this aspx is a pop-up (not an iframe), after user clicked on a button on the classic asp page. Using response.redirect will only open the page inside the pop-up itself, and not refreshing the parent page.
I am using below Javascript function for the Link in the homepage. Requirement is to link clicked automatically on page load.
Link-
document.writeln("Live Chat");
I have tried below steps like adding document.getElementById('zautoclick').click(); and added id="zautoclick" before href but the problem is that my page does not show the link neither it loads the second page which comes after clicking on Live Chat.
Please share some logic to work auto click in my scenario.
try this out
1)
$(function() {
$('#watchButton').click();
});
2)
window.ready=function(){
document.getElementById("linkid").click();
};
3)
window.onload=function(){
document.getElementById("linkid").click();
};
I want a part of another page with Ajax Loading. When you click on a button. I have a page. But, i want load only the .section div in the page. When i click on the button. Than only the .section page in the other page must be load.
But, how can i load with ajax / jquery. Only a div from a other page.
You can do this without ajax using jQuery's load method. With this, you can load the content returned into your #div_id or body. Here is an example to load your content into your page's body;
$("#your_button_id").click(function() {
var myUrl = "yourpage.html #div_id_having_data";
$("body").load(myUrl);
return false;
});
Take a look at the jQuery Ajax/load documentation
If i have understood your question properly, then this would be the solution,
On button click load the whole page (.section should be hidden). Then on click of the other button just toggle the .section div.
I have a “pop-up” web page inherits from System.Web.UI.Page in a plug-in which is a part of a large web framework. The markup is inside <asp:Content> below. I need to perform some actions (updating the page behind) when the user clicks on “Close” button (id = _close) and when the user clicks on the ‘x’ button on the right corner of the page. My page is not displayed in the browser. I got the “onclick” (in the code behind) to work for “Close” button below, but I don’t know how to detect when the ‘x’ button is clicked. I tried on window.beforeunload and window.onclose, it doesn’t work. “Hello World” pops up when my web page opens and when I click “Close” (_close) button.
How do I handle for the click on the ‘x’ the same way when “_close” button is clicked?
<script language="javascript">
function doClose() { alert('Hello World!'); } window.onload = doClose(); // also tried with window.beforeunload </script>
You can execute the code on the opener. Write a method in opener and execute it from the pop-up window.
http://www.w3schools.com/jsref/prop_win_opener.asp