It's very easy to generate 'click' event from script with JQuery
$(document).ready(function() {
var b = "<%=clicked%>";
if (b == "0") {
$("#Button1").click();
}
});
namespace ForceClick
{
public partial class _Default : System.Web.UI.Page
{
public int clicked = 0;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_OnClick(object sender, EventArgs e)
{
Button1.Text = "Clicked by JQuery";
clicked = 1;
}
}
}
Tuesday, January 20, 2009
Monday, January 19, 2009
Friday, January 16, 2009
WCF : http://www.sajay.com/post/2006/08/03/Using-a-Session-in-WCF-through-AspNetCompatibility.aspx
Explains the way to make WCF from IIS and enable session
http://www.sajay.com/post/2006/08/03/Using-a-Session-in-WCF-through-AspNetCompatibility.aspx
http://www.sajay.com/post/2006/08/03/Using-a-Session-in-WCF-through-AspNetCompatibility.aspx
Wednesday, January 14, 2009
Maîtriser les événements ASP.NET
Simple said, that is the best document i've ever found which explained clearly ASP.NET's events
In French.
http://www.dotnetguru.org/articles/aspnet/events/EventASPNET1.htm
In French.
http://www.dotnetguru.org/articles/aspnet/events/EventASPNET1.htm
Monday, January 12, 2009
JQuery : Silde
Learning jQuery in 30 minutes
From: simon,
2 years ago
Slides from a half hour jQuery tutorial at BarCamp London 3.
SlideShare Link
Sunday, January 11, 2009
Javascript : From Parent to Child
This case is not very well documented.
I found a nice tutorial here :
http://radio.javaranch.com/pascarello/2005/01/18/1106063002000.html
You can download samples here:
FromChildToParent
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication10._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
var w;
function openPopup() {
w = window.open("popup.aspx");
setTimeout("SendToChild()", 200);
//This works on FF.
w.onload = function() {
alert("child loaded");
}
}
function SendToChild() {
value = window.document.getElementById("tochild").value;
w.document.getElementById("fromparent").innerHTML = value;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="tochild" type="text" runat="server" />
<span id="opener" title="???" onclick="openPopup()" onmouseover="this.style.cursor='hand'">
Send To Child</span>
<hr />
Child said : <span id="fromchild"></span>
</div>
</form>
</body>
</html>
I found a nice tutorial here :
http://radio.javaranch.com/pascarello/2005/01/18/1106063002000.html
You can download samples here:
FromChildToParent
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication10._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
var w;
function openPopup() {
w = window.open("popup.aspx");
setTimeout("SendToChild()", 200);
//This works on FF.
w.onload = function() {
alert("child loaded");
}
}
function SendToChild() {
value = window.document.getElementById("tochild").value;
w.document.getElementById("fromparent").innerHTML = value;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="tochild" type="text" runat="server" />
<span id="opener" title="???" onclick="openPopup()" onmouseover="this.style.cursor='hand'">
Send To Child</span>
<hr />
Child said : <span id="fromchild"></span>
</div>
</form>
</body>
</html>
Javascript : From Child to Parent
Passing data between Popup to Parent window is easy once you are aware of the
method window.opener method
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="popup.aspx.vb" Inherits="WebApplication10.popup" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function alertParent() {
var divparent = window.opener.document.getElementById("fromchild");
var chidmsg = document.getElementById("toparent");
divparent.innerText = chidmsg.value;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="toparent" type="text" />
<input id="Button1" type="button" value="Respond to Parent" onclick="alertParent();" />
</div>
<hr />
Parent said : <span id="fromparent"></span>
</form>
</body>
</html>
method window.opener method
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="popup.aspx.vb" Inherits="WebApplication10.popup" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function alertParent() {
var divparent = window.opener.document.getElementById("fromchild");
var chidmsg = document.getElementById("toparent");
divparent.innerText = chidmsg.value;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="toparent" type="text" />
<input id="Button1" type="button" value="Respond to Parent" onclick="alertParent();" />
</div>
<hr />
Parent said : <span id="fromparent"></span>
</form>
</body>
</html>
Subscribe to:
Posts (Atom)