Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2010, 12:59 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Question Calling JS Function from code behind

I have very little knowledge of Java Script but I am trying to call Java Script Functions. I realize that I cannot call JS from code behind and therefore using OnClientClick.
Mark up:

<scripttype="JavaScript">
var Page;
var postBackElement;
function pageLoad()
{
Page = Sys.WebForms.PageRequestManager.getInstance();
Page.add_beginRequest(OnBeginRequest);
Page.add_endRequest(endRequest);
}
function OnBeginRequest(sender, args)
{
$get("IMGDIV").style.display="";
}
function endRequest(sender, args)
{
$get("IMGDIV").style.display="none";
}
</script>
</
head>
<
body>
<formid="form1"runat="server">
<divid="IMGDIV"style="display:none;position:absolute;left: 35%;top: 25%;vertical-align:middle;border-style:inset;border-color:black;background-color:White;z-index:103;">
<asp:ImageID="Image1"runat="server"ImageUrl="~/ajax-loader.gif"/>
<asp:LabelID="Label1"runat="server"Text="Loading...."/>
</div>
<asp:ButtonID="Button1"runat="server"Text="Button"OnClientClick="OnBeginRequest();"style="z-index: 100; left: 20px; position: absolute; top: 235px"/>
<asp:ButtonID="Button2"runat="server"Text="Button"OnClientClick="endRequest();"Style="z-index: 104; left: 163px; position: absolute; top: 234px"Text="Button"/>

Last edited by snufse; September 22nd, 2010 at 01:47 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
TBH.js Function loadProfile() error mansfield01 BOOK: ASP.NET 3.5 Website Programming Problem Design Solution 0 December 3rd, 2009 01:21 PM
JS function not seen rodmcleay Javascript 3 October 23rd, 2009 01:43 AM
Calling JS Function from VS? Ron Howerton Javascript 15 September 17th, 2008 02:35 PM
how to run a .js file from a javascript function sbkumar Javascript How-To 1 July 11th, 2008 11:12 AM
Trigger a JS function on loss of focus apd8x Javascript 1 July 14th, 2003 09:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.