Menu with include in classic asp - asp.net

Hi I have a menu in aspx page which works finely. So, I create a asp page called classicmenu.asp which consists of this
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('#menu').load('Menuin.aspx');
});
</script>
</head>
<body>
<div id="menu" >
<label runat="server">afggh</label>
</div>
<label runat="server">asd</label>
</body>
</html>
Even here it works fine. I can see the menu . So, once include this in another asp page, I just get the labels defined in classicmenu.asp but not the menu i define in aspx page. So, can u guys help me out?

Where in the folder structure is the page that includes classicmenu.asp? If it's not in the same directory as Menuin.aspx, then the JS won't know where to find it when trying to load().

Related

Updating a page from another page without refreshing the page

I have two web pages written in VisualBasic.Net:
Upload.aspx
Default.aspx
There is a link in the Default page that opens Upload page in a different window.
In the Upload window I upload a file, and I want to display the name of this file in a textbox, which in turn is in a gridview on the Default page.
I think I want an asyncronous process that won't cause the Default page to refresh, but I don't know how to do this.
I created a very simple example for you. Here is the code of the first page (your Default.aspx let's say):
<html>
<head>
<script>
function ow() {
window.open('w2.html');
}
function update(updatestr) {
document.getElementById('update').innerHTML = updatestr;
}
</script>
</head>
<body>
open window
<div id="update"></div>
</body>
</html>
This page contains a link, which opens a new window (this will be your Upload.aspx page). It also contains a simple function called update, which puts a parameter value as a div html content.
This is code of a second page (your Upload.aspx like):
<html>
<head>
<script>
function update() {
window.opener.update(document.getElementById('txt').value);
}
</script>
</head>
<body>
<input type="text" id="txt" />
<input type="button" value="Update" onclick="update()"/>
</body>
</html>
This page contains a textbox and a button. After a button click, the content of the textbox will appear in a div on the first page. You can do something similar in your case.
I've put a working demo for you.

jQuery Globalize plugin giving an error always in an aspx Webforms page

I have a simple aspx page using jQuery globalize plugin that I created based on the Demo solution from this url: https://weblogs.asp.net/scottgu/jquery-globalization-plugin-from-microsoft.
I am using Visual Studio 2013 Pro version with .Net framework 4.5.1 and the project with this aspx page is a website project.
I always get a JavaScript error when this simple aspx page renders. A screenshot of this error is as below.
The markup of this simple aspx is also given below. No code-behind code is being used for this page.
Question : What could be causing this since similar code in Demo samples from Scott's blog works without any errors? All script files are correctly loading that I verified in Chrome's Source tab, so this is very confusing.
Markup of simple aspx
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default18.aspx.cs" Inherits="Default18" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>UK Store</title>
<script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="Scripts/jQuery.glob.min.js" type="text/javascript"></script>
<script src="Scripts/globinfo/jQuery.glob.en-GB.min.js" type="text/javascript"></script>
<script type="text/javascript">
$.preferCulture("en-GB");
</script>
</head>
<body>
<h1>Apple Strudel</h1>
Product Price: <span id="price"></span>
<br />
Date Available: <span id="available"></span>
<br />
Units in Stock: <span id="units"></span>
</body>
</html>
I finally found the problem. The minified file jQuery.glob.min.js that was in the Demos solution at https://weblogs.asp.net/scottgu/jquery-globalization-plugin-from-microsoft was not correct, but jQuery.glob.js from same location was correct since my aspx page worked with it.
So I just created a new minified file using jQuery.glob.js and then everything worked perfectly with my aspx page.

IFrame in content script. How to communicate with main.js?

My Firefox add-on opens Fancybox (type: "iframe") from a content script (page-mod). In the Fancybox I show my own HTML page (my_fancybox_stuff.html) that is located in my own server.
Now, from the my_fancybox_stuff.js (javascript of my_fancybox_stuff.html), can I send a message to the add-on's main.js? Or to the content script that opened the Fancybox?
I was hoping the global 'self' object to be accessible from my_fancybox_stuff.js as it is accessible from the content script that opened the Fancybox.
I am interested to hear about any potential workarounds to get this done.
In Chrome extension this is trivial. In my_fancybox_stuff.js I can call chrome.extension.sendMessage() and it works.
Thanks in advance!
EDIT: Adding some code to clarify my case. Simplified the code to save folks' time on reading it. This is simple as hello world.
From the contents_scipt.js (injected with page-mod) I call:
$.fancybox.open(
{
// Some irrelevant Fancybox options hidden for clarity
href:"http://www.mysite.com/my_fancybox_stuff.html
type: 'iframe'
}
);
my_fancybox_stuff.html would look something like this:
<!doctype html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/jquery.js"></script>
<script src="js/my_fancybox_stuff.js"></script>
</head>
<body>
<div id="my-wrapper">
<div id="my-form-div">
<form id="my-form" action="#">
<div>
<div><p>Name</p></div>
<div><input id="fullname" type="text" name="fullname" value=""></div>
</div>
<div>
<div><p><a id="my-button" href="#">Press this</a></p></div>
</div>
</form>
</div>
</div>
</body>
In my_fancybox_stuff.js, when button ("my_button") is pressed, I want to send out a message containing the value of the input field ("fullname") and listen it in content_script.js.
Yes, your my_fancybox_stuff.js can communicate with your add-on's content script using postMessage ().
See the documentation and examples at MDN.

dijit.form.DateTextBox is not visible when the page is loaded

When my page is loaded I cannot see calendar:
When I click on the birthday field of the form it appears, but it does not look as I expect:
The code I use to display in jsp file:
<label for="birthday">Birthday<br/> </label>
<sf:input path="birthday" id="birthday"
pattern="(0[1-9]|1[0-9]|2[0-9]|3[01])-(0[1-9]|1[012])-[0-9]{4}"/><br/>
<script type="text/javascript">
Spring.addDecoration(new Spring.ElementDecoration({
elementId:"birthday",
widgetType:"dijit.form.DateTextBox",
widgetAttrs:{ datePattern:"dd-MM-yyyy", required:true }}));
</script>
So my questions are:
How to make calendar always visible as soon as the form is loaded?
How can I manage with its css, so I could set backgournd and other properties via css file? If it is not possible, then via JavaScript params.
Thanks.
In order the calendar works I had to set the following css class to the html body element:
<body class="tundra">
It helped.

Like pageflakes (Incremental Page Display OR Lazy Load)?

I need to know how to load user control after the page is completely loaded
Incremental Page Display OR Lazy Load concept
typically like Pageflakes ?
This is called Ajax: http://www.w3schools.com/Ajax/ajax_intro.asp
To address your comment below, here is a (VERY SIMPLE) example of such a thing, using the jQuery library. http://jquery.com/
<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$("#content").load("/myajaxpage.htm");
});
</script>
</head>
<body>
<div id="content"></div>
</body>
</html>
This would download the myajaxpage.htm page after loading, and put the contents into the div with the id "content".

Resources