473,698 Members | 2,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET Ajax beginner question

Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/I...datePanel.aspx to create my
first testing page, The problem is after I clicked that botton, it still
trigged a postback. Do I miss something?

Following is my code:

<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label1" runat="server" Text="Parcel created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}

protected void Button1_Click(o bject sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.To String();
}
}

Html code generated by page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default .aspx" id="form1">
<div>
<input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET" value="" />
<input type="hidden" name="__EVENTAR GUMENT" id="__EVENTARGU MENT" value="" />
<input type="hidden" name="__VIEWSTA TE" id="__VIEWSTATE "
value="/wEPDwULLTEyNTU5 OTE4NDBkZFFbG+x INimfJjnJzMPyN5/bdPcr" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(ev entTarget, eventArgument) {
if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
theForm.__EVENT TARGET.value = eventTarget;
theForm.__EVENT ARGUMENT.value = eventArgument;
theForm.submit( );
}
}
// -->
</script>
<script
src="/AjaxSandbox/WebResource.axd ?d=uPSIJPV09GNZ kXa1aWLuZA2&t=6 329615603416376 22" type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW5yqEjrhRE y__cV5gKfSghPU1 &t=633053156500 271737" type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW572e2ypQh yGf_JtyUNuUy11_ drtp-tXJrGLYVAgwBUoK 0&t=63305315650 0271737" type="text/javascript"></script>
<div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.Pa geRequestManage r._initialize(' ScriptManager1' ,
document.getEle mentById('form1 '));
Sys.WebForms.Pa geRequestManage r.getInstance() ._updateControl s(['tUpdatePanel1'], [], [], 90);
//]]>
</script>

<div id="UpdatePanel 1">

<span id="Label1">Par cel created</span>
<input type="submit" name="Button1" value="Button" id="Button1" />

</div>
</div>

<div>

<input type="hidden" name="__EVENTVA LIDATION" id="__EVENTVALI DATION"
value="/wEWAgLk5+S6DwKM 54rGBofhZslYBM4 FNpmEHJadJ6r8Aq 3Z" />
</div>

<script type="text/javascript">
<!--
Sys.Application .initialize();
// -->
</script>
</form>
</body>
</html>
--
Regards
Hardy
Jan 31 '07 #1
9 1868
Hi,

you need to set EnablePartialRe ndering="true" to the <asp:ScriptMana ger>

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/I...datePanel.aspx to create
my
first testing page, The problem is after I clicked that botton, it still
trigged a postback. Do I miss something?

Following is my code:

<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label1" runat="server" Text="Parcel created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}

protected void Button1_Click(o bject sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.To String();
}
}

Html code generated by page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default .aspx" id="form1">
<div>
<input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET" value="" />
<input type="hidden" name="__EVENTAR GUMENT" id="__EVENTARGU MENT" value=""
/>
<input type="hidden" name="__VIEWSTA TE" id="__VIEWSTATE "
value="/wEPDwULLTEyNTU5 OTE4NDBkZFFbG+x INimfJjnJzMPyN5/bdPcr" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(ev entTarget, eventArgument) {
if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
theForm.__EVENT TARGET.value = eventTarget;
theForm.__EVENT ARGUMENT.value = eventArgument;
theForm.submit( );
}
}
// -->
</script>
<script
src="/AjaxSandbox/WebResource.axd ?d=uPSIJPV09GNZ kXa1aWLuZA2&t=6 329615603416376 22"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW5yqEjrhRE y__cV5gKfSghPU1 &t=633053156500 271737"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW572e2ypQh yGf_JtyUNuUy11_ drtp-tXJrGLYVAgwBUoK 0&t=63305315650 0271737"
type="text/javascript"></script>
<div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.Pa geRequestManage r._initialize(' ScriptManager1' ,
document.getEle mentById('form1 '));
Sys.WebForms.Pa geRequestManage r.getInstance() ._updateControl s(['tUpdatePanel1'],
[], [], 90);
//]]>
</script>

<div id="UpdatePanel 1">

<span id="Label1">Par cel created</span>
<input type="submit" name="Button1" value="Button" id="Button1" />

</div>
</div>

<div>

<input type="hidden" name="__EVENTVA LIDATION" id="__EVENTVALI DATION"
value="/wEWAgLk5+S6DwKM 54rGBofhZslYBM4 FNpmEHJadJ6r8Aq 3Z" />
</div>

<script type="text/javascript">
<!--
Sys.Application .initialize();
// -->
</script>
</form>
</body>
</html>
--
Regards
Hardy
Jan 31 '07 #2
No luck, it is still a postback.

"Teemu Keiski" wrote:
Hi,

you need to set EnablePartialRe ndering="true" to the <asp:ScriptMana ger>

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/I...datePanel.aspx to create
my
first testing page, The problem is after I clicked that botton, it still
trigged a postback. Do I miss something?

Following is my code:

<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label1" runat="server" Text="Parcel created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}

protected void Button1_Click(o bject sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.To String();
}
}

Html code generated by page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default .aspx" id="form1">
<div>
<input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET" value="" />
<input type="hidden" name="__EVENTAR GUMENT" id="__EVENTARGU MENT" value=""
/>
<input type="hidden" name="__VIEWSTA TE" id="__VIEWSTATE "
value="/wEPDwULLTEyNTU5 OTE4NDBkZFFbG+x INimfJjnJzMPyN5/bdPcr" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(ev entTarget, eventArgument) {
if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
theForm.__EVENT TARGET.value = eventTarget;
theForm.__EVENT ARGUMENT.value = eventArgument;
theForm.submit( );
}
}
// -->
</script>
<script
src="/AjaxSandbox/WebResource.axd ?d=uPSIJPV09GNZ kXa1aWLuZA2&t=6 329615603416376 22"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW5yqEjrhRE y__cV5gKfSghPU1 &t=633053156500 271737"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW572e2ypQh yGf_JtyUNuUy11_ drtp-tXJrGLYVAgwBUoK 0&t=63305315650 0271737"
type="text/javascript"></script>
<div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.Pa geRequestManage r._initialize(' ScriptManager1' ,
document.getEle mentById('form1 '));
Sys.WebForms.Pa geRequestManage r.getInstance() ._updateControl s(['tUpdatePanel1'],
[], [], 90);
//]]>
</script>

<div id="UpdatePanel 1">

<span id="Label1">Par cel created</span>
<input type="submit" name="Button1" value="Button" id="Button1" />

</div>
</div>

<div>

<input type="hidden" name="__EVENTVA LIDATION" id="__EVENTVALI DATION"
value="/wEWAgLk5+S6DwKM 54rGBofhZslYBM4 FNpmEHJadJ6r8Aq 3Z" />
</div>

<script type="text/javascript">
<!--
Sys.Application .initialize();
// -->
</script>
</form>
</body>
</html>
--
Regards
Hardy
Jan 31 '07 #3
That needs still to be set for it to work, But: What does your application's
web.config look like? Setting up ASP.NEt Aajx requires a few lines there.
For example my ASP.NET Ajax enabled app's web.config looks like

<?xml version="1.0"?>
<configuratio n>
<configSections >
<sectionGroup name="system.we b.extensions"
type="System.We b.Configuration .SystemWebExten sionsSectionGro up,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5">
<sectionGroup name="scripting "
type="System.We b.Configuration .ScriptingSecti onGroup, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5">
<section name="scriptRes ourceHandler"
type="System.We b.Configuration .ScriptingScrip tResourceHandle rSection,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication"/>
<sectionGroup name="webServic es"
type="System.We b.Configuration .ScriptingWebSe rvicesSectionGr oup,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5">
<section name="jsonSeria lization"
type="System.We b.Configuration .ScriptingJsonS erializationSec tion,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="Everywhere " />
<section name="profileSe rvice"
type="System.We b.Configuration .ScriptingProfi leServiceSectio n,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication" />
<section name="authentic ationService"
type="System.We b.Configuration .ScriptingAuthe nticationServic eSection,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="Syst em.Web.UI"
assembly="Syste m.Web.Extension s, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</assemblies>
</compilation>

<httpHandlers >
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false "
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add verb="*" path="*_AppServ ice.axd" validate="false "
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add verb="GET,HEAD" path="ScriptRes ource.axd"
type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
validate="false "/>
</httpHandlers>

<httpModules>
<add name="ScriptMod ule" type="System.We b.Handlers.Scri ptModule,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
</httpModules>
</system.web>

<system.web.ext ensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom
converter -->
<!--
<jsonSerializat ion maxJsonLength=" 500">
<converters>
<add name="ConvertMe " type="Acme.SubA cme.ConvertMeTy peConverter"/>
</converters>
</jsonSerializati on>
-->
<!-- Uncomment this line to enable the authentication service. Include
requireSSL="tru e" if appropriate. -->
<!--
<authentication Service enabled="true" requireSSL = "true|false "/>
-->

<!-- Uncomment these lines to enable the profile service. To allow
profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each
property name to the readAccessPrope rties and
writeAccessProp erties attributes. -->
<!--
<profileServi ce enabled="true"
readAccessPrope rties="property name1,propertyn ame2"
writeAccessProp erties="propert yname1,property name2" />
-->
</webServices>
<!--
<scriptResource Handler enableCompressi on="true" enableCaching=" true"
/>
-->
</scripting>
</system.web.exte nsions>

<system.webServ er>
<validation validateIntegra tedModeConfigur ation="false"/>
<modules>
<add name="ScriptMod ule" preCondition="i ntegratedMode"
type="System.We b.Handlers.Scri ptModule, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</modules>
<handlers>
<remove name="WebServic eHandlerFactory-Integrated" />
<add name="ScriptHan dlerFactory" verb="*" path="*.asmx"
preCondition="i ntegratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add name="ScriptHan dlerFactoryAppS ervices" verb="*"
path="*_AppServ ice.axd" preCondition="i ntegratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add name="ScriptRes ource" preCondition="i ntegratedMode"
verb="GET,HEAD" path="ScriptRes ource.axd"
type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5" />
</handlers>
</system.webServe r>
</configuration>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:E3******** *************** ***********@mic rosoft.com...
No luck, it is still a postback.

"Teemu Keiski" wrote:
>Hi,

you need to set EnablePartialRe ndering="true" to the <asp:ScriptMana ger>

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:B2******* *************** ************@mi crosoft.com...
Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/I...datePanel.aspx to
create
my
first testing page, The problem is after I clicked that botton, it
still
trigged a postback. Do I miss something?

Following is my code:

<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label1" runat="server" Text="Parcel
created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}

protected void Button1_Click(o bject sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.To String();
}
}

Html code generated by page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default .aspx" id="form1">
<div>
<input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET" value=""
/>
<input type="hidden" name="__EVENTAR GUMENT" id="__EVENTARGU MENT"
value=""
/>
<input type="hidden" name="__VIEWSTA TE" id="__VIEWSTATE "
value="/wEPDwULLTEyNTU5 OTE4NDBkZFFbG+x INimfJjnJzMPyN5/bdPcr" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(ev entTarget, eventArgument) {
if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
theForm.__EVENT TARGET.value = eventTarget;
theForm.__EVENT ARGUMENT.value = eventArgument;
theForm.submit( );
}
}
// -->
</script>
<script
src="/AjaxSandbox/WebResource.axd ?d=uPSIJPV09GNZ kXa1aWLuZA2&t=6 329615603416376 22"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW5yqEjrhRE y__cV5gKfSghPU1 &t=633053156500 271737"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW572e2ypQh yGf_JtyUNuUy11_ drtp-tXJrGLYVAgwBUoK 0&t=63305315650 0271737"
type="text/javascript"></script>
<div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.Pa geRequestManage r._initialize(' ScriptManager1' ,
document.getEle mentById('form1 '));
Sys.WebForms.Pa geRequestManage r.getInstance() ._updateControl s(['tUpdatePanel1'],
[], [], 90);
//]]>
</script>

<div id="UpdatePanel 1">

<span id="Label1">Par cel created</span>
<input type="submit" name="Button1" value="Button" id="Button1" />

</div>
</div>

<div>

<input type="hidden" name="__EVENTVA LIDATION" id="__EVENTVALI DATION"
value="/wEWAgLk5+S6DwKM 54rGBofhZslYBM4 FNpmEHJadJ6r8Aq 3Z" />
</div>

<script type="text/javascript">
<!--
Sys.Application .initialize();
// -->
</script>
</form>
</body>
</html>
--
Regards
Hardy
Jan 31 '07 #4
VS2005 added following for me automatically, and that's all.
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31BF3856AD364E3 5"/></assemblies>
</compilation>

There are so many keys you listed, I do need to add them all?

"Teemu Keiski" wrote:
That needs still to be set for it to work, But: What does your application's
web.config look like? Setting up ASP.NEt Aajx requires a few lines there.
For example my ASP.NET Ajax enabled app's web.config looks like

<?xml version="1.0"?>
<configuratio n>
<configSections >
<sectionGroup name="system.we b.extensions"
type="System.We b.Configuration .SystemWebExten sionsSectionGro up,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5">
<sectionGroup name="scripting "
type="System.We b.Configuration .ScriptingSecti onGroup, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5">
<section name="scriptRes ourceHandler"
type="System.We b.Configuration .ScriptingScrip tResourceHandle rSection,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication"/>
<sectionGroup name="webServic es"
type="System.We b.Configuration .ScriptingWebSe rvicesSectionGr oup,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5">
<section name="jsonSeria lization"
type="System.We b.Configuration .ScriptingJsonS erializationSec tion,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="Everywhere " />
<section name="profileSe rvice"
type="System.We b.Configuration .ScriptingProfi leServiceSectio n,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication" />
<section name="authentic ationService"
type="System.We b.Configuration .ScriptingAuthe nticationServic eSection,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="Syst em.Web.UI"
assembly="Syste m.Web.Extension s, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</assemblies>
</compilation>

<httpHandlers >
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false "
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add verb="*" path="*_AppServ ice.axd" validate="false "
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add verb="GET,HEAD" path="ScriptRes ource.axd"
type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
validate="false "/>
</httpHandlers>

<httpModules>
<add name="ScriptMod ule" type="System.We b.Handlers.Scri ptModule,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
</httpModules>
</system.web>

<system.web.ext ensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom
converter -->
<!--
<jsonSerializat ion maxJsonLength=" 500">
<converters>
<add name="ConvertMe " type="Acme.SubA cme.ConvertMeTy peConverter"/>
</converters>
</jsonSerializati on>
-->
<!-- Uncomment this line to enable the authentication service. Include
requireSSL="tru e" if appropriate. -->
<!--
<authentication Service enabled="true" requireSSL = "true|false "/>
-->

<!-- Uncomment these lines to enable the profile service. To allow
profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each
property name to the readAccessPrope rties and
writeAccessProp erties attributes. -->
<!--
<profileServi ce enabled="true"
readAccessPrope rties="property name1,propertyn ame2"
writeAccessProp erties="propert yname1,property name2" />
-->
</webServices>
<!--
<scriptResource Handler enableCompressi on="true" enableCaching=" true"
/>
-->
</scripting>
</system.web.exte nsions>

<system.webServ er>
<validation validateIntegra tedModeConfigur ation="false"/>
<modules>
<add name="ScriptMod ule" preCondition="i ntegratedMode"
type="System.We b.Handlers.Scri ptModule, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</modules>
<handlers>
<remove name="WebServic eHandlerFactory-Integrated" />
<add name="ScriptHan dlerFactory" verb="*" path="*.asmx"
preCondition="i ntegratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add name="ScriptHan dlerFactoryAppS ervices" verb="*"
path="*_AppServ ice.axd" preCondition="i ntegratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add name="ScriptRes ource" preCondition="i ntegratedMode"
verb="GET,HEAD" path="ScriptRes ource.axd"
type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5" />
</handlers>
</system.webServe r>
</configuration>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:E3******** *************** ***********@mic rosoft.com...
No luck, it is still a postback.

"Teemu Keiski" wrote:
Hi,

you need to set EnablePartialRe ndering="true" to the <asp:ScriptMana ger>

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/I...datePanel.aspx to
create
my
first testing page, The problem is after I clicked that botton, it
still
trigged a postback. Do I miss something?

Following is my code:

<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label1" runat="server" Text="Parcel
created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}

protected void Button1_Click(o bject sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.To String();
}
}

Html code generated by page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default .aspx" id="form1">
<div>
<input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET" value=""
/>
<input type="hidden" name="__EVENTAR GUMENT" id="__EVENTARGU MENT"
value=""
/>
<input type="hidden" name="__VIEWSTA TE" id="__VIEWSTATE "
value="/wEPDwULLTEyNTU5 OTE4NDBkZFFbG+x INimfJjnJzMPyN5/bdPcr" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(ev entTarget, eventArgument) {
if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
theForm.__EVENT TARGET.value = eventTarget;
theForm.__EVENT ARGUMENT.value = eventArgument;
theForm.submit( );
}
}
// -->
</script>
<script
src="/AjaxSandbox/WebResource.axd ?d=uPSIJPV09GNZ kXa1aWLuZA2&t=6 329615603416376 22"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW5yqEjrhRE y__cV5gKfSghPU1 &t=633053156500 271737"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW572e2ypQh yGf_JtyUNuUy11_ drtp-tXJrGLYVAgwBUoK 0&t=63305315650 0271737"
type="text/javascript"></script>
<div>
<script type="text/javascript">
//<![CDATA[
Jan 31 '07 #5
I added the config as attachment to this msg. At least you need to have
scripting-related stuff there (modules and handlers) but I might add them
all. <system.webServ eris IIS 7.0 related stuff (I use Vista), and you can
ignore that if you don't use it.

See following link for details what each setting means:
http://ajax.asp.net/docs/ConfiguringASPNETAJAX.aspx
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:5C******** *************** ***********@mic rosoft.com...
VS2005 added following for me automatically, and that's all.
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral ,
PublicKeyToken= 31BF3856AD364E3 5"/></assemblies>
</compilation>

There are so many keys you listed, I do need to add them all?

"Teemu Keiski" wrote:
>That needs still to be set for it to work, But: What does your
application' s
web.config look like? Setting up ASP.NEt Aajx requires a few lines there.
For example my ASP.NET Ajax enabled app's web.config looks like

<?xml version="1.0"?>
<configuration >
<configSections >
<sectionGroup name="system.we b.extensions"
type="System.W eb.Configuratio n.SystemWebExte nsionsSectionGr oup,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35">
<sectionGroup name="scripting "
type="System.W eb.Configuratio n.ScriptingSect ionGroup,
System.Web.Ext ensions,
Version=1.0.61 025.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5">
<section name="scriptRes ourceHandler"
type="System.W eb.Configuratio n.ScriptingScri ptResourceHandl erSection,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35" requirePermissi on="false"
allowDefinitio n="MachineToApp lication"/>
<sectionGroup name="webServic es"
type="System.W eb.Configuratio n.ScriptingWebS ervicesSectionG roup,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35">
<section name="jsonSeria lization"
type="System.W eb.Configuratio n.ScriptingJson SerializationSe ction,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35" requirePermissi on="false"
allowDefinitio n="Everywhere " />
<section name="profileSe rvice"
type="System.W eb.Configuratio n.ScriptingProf ileServiceSecti on,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35" requirePermissi on="false"
allowDefinitio n="MachineToApp lication" />
<section name="authentic ationService"
type="System.W eb.Configuratio n.ScriptingAuth enticationServi ceSection,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35" requirePermissi on="false"
allowDefinitio n="MachineToApp lication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="Syst em.Web.UI"
assembly="Syst em.Web.Extensio ns, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutra l, PublicKeyToken= 31bf3856ad364e3 5"/>
</assemblies>
</compilation>

<httpHandlers >
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false "
type="System.W eb.Script.Servi ces.ScriptHandl erFactory,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35"/>
<add verb="*" path="*_AppServ ice.axd" validate="false "
type="System.W eb.Script.Servi ces.ScriptHandl erFactory,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35"/>
<add verb="GET,HEAD" path="ScriptRes ource.axd"
type="System.W eb.Handlers.Scr iptResourceHand ler, System.Web.Exte nsions,
Version=1.0.61 025.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
validate="fals e"/>
</httpHandlers>

<httpModules>
<add name="ScriptMod ule" type="System.We b.Handlers.Scri ptModule,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35"/>
</httpModules>
</system.web>

<system.web.ext ensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a
custom
converter -->
<!--
<jsonSerializat ion maxJsonLength=" 500">
<converters>
<add name="ConvertMe "
type="Acme.Sub Acme.ConvertMeT ypeConverter"/>
</converters>
</jsonSerializati on>
-->
<!-- Uncomment this line to enable the authentication service.
Include
requireSSL="tr ue" if appropriate. -->
<!--
<authentication Service enabled="true" requireSSL = "true|false "/>
-->

<!-- Uncomment these lines to enable the profile service. To allow
profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add
each
property name to the readAccessPrope rties and
writeAccessProp erties attributes. -->
<!--
<profileServi ce enabled="true"
readAccessPrope rties="property name1,propertyn ame2"
writeAccessProp erties="propert yname1,property name2"
/>
-->
</webServices>
<!--
<scriptResource Handler enableCompressi on="true"
enableCaching= "true"
/>
-->
</scripting>
</system.web.exte nsions>

<system.webServ er>
<validation validateIntegra tedModeConfigur ation="false"/>
<modules>
<add name="ScriptMod ule" preCondition="i ntegratedMode"
type="System.W eb.Handlers.Scr iptModule, System.Web.Exte nsions,
Version=1.0.61 025.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</modules>
<handlers>
<remove name="WebServic eHandlerFactory-Integrated" />
<add name="ScriptHan dlerFactory" verb="*" path="*.asmx"
preCondition=" integratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35"/>
<add name="ScriptHan dlerFactoryAppS ervices" verb="*"
path="*_AppSer vice.axd" preCondition="i ntegratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Ext ensions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken =31bf3856ad364e 35"/>
<add name="ScriptRes ource" preCondition="i ntegratedMode"
verb="GET,HEAD " path="ScriptRes ource.axd"
type="System.W eb.Handlers.Scr iptResourceHand ler, System.Web.Exte nsions,
Version=1.0.61 025.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5" />
</handlers>
</system.webServe r>
</configuration>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:E3******* *************** ************@mi crosoft.com...
No luck, it is still a postback.

"Teemu Keiski" wrote:

Hi,

you need to set EnablePartialRe ndering="true" to the
<asp:ScriptMan ager>

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:B2******* *************** ************@mi crosoft.com...
Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/I...datePanel.aspx to
create
my
first testing page, The problem is after I clicked that botton, it
still
trigged a postback. Do I miss something?

Following is my code:

<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label1" runat="server" Text="Parcel
created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}

protected void Button1_Click(o bject sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.To String();
}
}

Html code generated by page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default .aspx"
id="form1">
<div>
<input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET"
value=""
/>
<input type="hidden" name="__EVENTAR GUMENT" id="__EVENTARGU MENT"
value=""
/>
<input type="hidden" name="__VIEWSTA TE" id="__VIEWSTATE "
value="/wEPDwULLTEyNTU5 OTE4NDBkZFFbG+x INimfJjnJzMPyN5/bdPcr" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(ev entTarget, eventArgument) {
if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
theForm.__EVENT TARGET.value = eventTarget;
theForm.__EVENT ARGUMENT.value = eventArgument;
theForm.submit( );
}
}
// -->
</script>
<script
src="/AjaxSandbox/WebResource.axd ?d=uPSIJPV09GNZ kXa1aWLuZA2&t=6 329615603416376 22"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW5yqEjrhRE y__cV5gKfSghPU1 &t=633053156500 271737"
type="text/javascript"></script>
<script
src="/AjaxSandbox/ScriptResource. axd?d=Rdf9isNeX MPi-qNzO-XVRmXNOH0DmLQG-4RxW5WORPfrZ2K0 YD5Icg_Bz9c5f0-wuytwMMng0hZa1k 1SSKrW572e2ypQh yGf_JtyUNuUy11_ drtp-tXJrGLYVAgwBUoK 0&t=63305315650 0271737"
type="text/javascript"></script>
<div>
<script type="text/javascript">
//<![CDATA[
Jan 31 '07 #6
"Hardy Wang" wrote ...
VS2005 added following for me automatically, and that's all.
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral ,
PublicKeyToken= 31BF3856AD364E3 5"/></assemblies>
</compilation>
Sounds like you might have the release candidate instead of the 1.0
release - I noticed that the 1.0 release changed the web.config file
significantly.

Did you "remove" via Add/Remove programs the RC before installing 1.0?

Incidentally, I am also getting full postbacks with all of my Ajax testing,
and I am using 1.0, and have the config as posted by Teemu....so any help in
this area would be appreciated...

Rob
Feb 1 '07 #7
Thanks, I copied your config file, it works. Then I removed lines might not
be neccessary, and just keep following.
<?xml version="1.0"?>
<configuratio n>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="Syst em.Web.UI"
assembly="Syste m.Web.Extension s, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
</controls>
</pages>
<compilation debug="true">
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</assemblies>
</compilation>
</system.web>
</configuration>
"Teemu Keiski" wrote:
I added the config as attachment to this msg. At least you need to have
scripting-related stuff there (modules and handlers) but I might add them
all. <system.webServ eris IIS 7.0 related stuff (I use Vista), and you can
ignore that if you don't use it.

See following link for details what each setting means:
http://ajax.asp.net/docs/ConfiguringASPNETAJAX.aspx
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:5C******** *************** ***********@mic rosoft.com...
VS2005 added following for me automatically, and that's all.
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral ,
PublicKeyToken= 31BF3856AD364E3 5"/></assemblies>
</compilation>

There are so many keys you listed, I do need to add them all?

"Teemu Keiski" wrote:
That needs still to be set for it to work, But: What does your
application's
web.config look like? Setting up ASP.NEt Aajx requires a few lines there.
For example my ASP.NET Ajax enabled app's web.config looks like

<?xml version="1.0"?>
<configuratio n>
<configSections >
<sectionGroup name="system.we b.extensions"
type="System.We b.Configuration .SystemWebExten sionsSectionGro up,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5">
<sectionGroup name="scripting "
type="System.We b.Configuration .ScriptingSecti onGroup,
System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5">
<section name="scriptRes ourceHandler"
type="System.We b.Configuration .ScriptingScrip tResourceHandle rSection,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication"/>
<sectionGroup name="webServic es"
type="System.We b.Configuration .ScriptingWebSe rvicesSectionGr oup,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5">
<section name="jsonSeria lization"
type="System.We b.Configuration .ScriptingJsonS erializationSec tion,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="Everywhere " />
<section name="profileSe rvice"
type="System.We b.Configuration .ScriptingProfi leServiceSectio n,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication" />
<section name="authentic ationService"
type="System.We b.Configuration .ScriptingAuthe nticationServic eSection,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" requirePermissi on="false"
allowDefinition ="MachineToAppl ication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="Syst em.Web.UI"
assembly="Syste m.Web.Extension s, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</assemblies>
</compilation>

<httpHandlers >
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false "
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add verb="*" path="*_AppServ ice.axd" validate="false "
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add verb="GET,HEAD" path="ScriptRes ource.axd"
type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
validate="false "/>
</httpHandlers>

<httpModules>
<add name="ScriptMod ule" type="System.We b.Handlers.Scri ptModule,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
</httpModules>
</system.web>

<system.web.ext ensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a
custom
converter -->
<!--
<jsonSerializat ion maxJsonLength=" 500">
<converters>
<add name="ConvertMe "
type="Acme.SubA cme.ConvertMeTy peConverter"/>
</converters>
</jsonSerializati on>
-->
<!-- Uncomment this line to enable the authentication service.
Include
requireSSL="tru e" if appropriate. -->
<!--
<authentication Service enabled="true" requireSSL = "true|false "/>
-->

<!-- Uncomment these lines to enable the profile service. To allow
profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add
each
property name to the readAccessPrope rties and
writeAccessProp erties attributes. -->
<!--
<profileServi ce enabled="true"
readAccessPrope rties="property name1,propertyn ame2"
writeAccessProp erties="propert yname1,property name2"
/>
-->
</webServices>
<!--
<scriptResource Handler enableCompressi on="true"
enableCaching=" true"
/>
-->
</scripting>
</system.web.exte nsions>

<system.webServ er>
<validation validateIntegra tedModeConfigur ation="false"/>
<modules>
<add name="ScriptMod ule" preCondition="i ntegratedMode"
type="System.We b.Handlers.Scri ptModule, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"/>
</modules>
<handlers>
<remove name="WebServic eHandlerFactory-Integrated" />
<add name="ScriptHan dlerFactory" verb="*" path="*.asmx"
preCondition="i ntegratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add name="ScriptHan dlerFactoryAppS ervices" verb="*"
path="*_AppServ ice.axd" preCondition="i ntegratedMode"
type="System.We b.Script.Servic es.ScriptHandle rFactory,
System.Web.Exte nsions, Version=1.0.610 25.0, Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5"/>
<add name="ScriptRes ource" preCondition="i ntegratedMode"
verb="GET,HEAD" path="ScriptRes ource.axd"
type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions,
Version=1.0.610 25.0, Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5" />
</handlers>
</system.webServe r>
</configuration>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:E3******** *************** ***********@mic rosoft.com...
No luck, it is still a postback.

"Teemu Keiski" wrote:

Hi,

you need to set EnablePartialRe ndering="true" to the
<asp:ScriptMana ger>

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Hardy Wang" <Ha*******@disc ussions.microso ft.comwrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hi all,
I followed first walk through sample from
http://ajax.asp.net/docs/tutorials/I...datePanel.aspx to
create
my
first testing page, The problem is after I clicked that botton, it
still
trigged a postback. Do I miss something?

Following is my code:

<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label1" runat="server" Text="Parcel
created"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}

protected void Button1_Click(o bject sender, EventArgs e) {
Label1.Text = "Refreshed at " + DateTime.Now.To String();
}
}

Html code generated by page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default .aspx"
id="form1">
<div>
<input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET"
Feb 1 '07 #8
This is the first time I download this library, I downloaded it from
http://www.microsoft.com/downloads/d...displaylang=en this should be release 1.0?

"Rob Meade" wrote:
"Hardy Wang" wrote ...
VS2005 added following for me automatically, and that's all.
<assemblies>
<add assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral ,
PublicKeyToken= 31BF3856AD364E3 5"/></assemblies>
</compilation>

Sounds like you might have the release candidate instead of the 1.0
release - I noticed that the 1.0 release changed the web.config file
significantly.

Did you "remove" via Add/Remove programs the RC before installing 1.0?

Incidentally, I am also getting full postbacks with all of my Ajax testing,
and I am using 1.0, and have the config as posted by Teemu....so any help in
this area would be appreciated...

Rob
Feb 1 '07 #9
"Hardy Wang" wrote ...
This is the first time I download this library, I downloaded it from
http://www.microsoft.com/downloads/d...displaylang=en
this should be release 1.0?
Yep - thats release 1.0

Just thought I'd mention what I did as I've seen a few forum posts where
people had run into problems where they have previous versions installed..

Regards

Rob
Feb 2 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1764
by: darrel | last post by:
I've been playing with prototype.js and scriptaculous to create some nice drag-and-drop interaction on my applications GUI. That's working well. Now I want to take the next step and start passing data back and forth between my page and the server via AJAX. In terms of .net, can someone give me the overall concept? Normally, I'd have a function in my codebehind that grabs a dataset and then binds that to a control on my aspx page.
4
3837
by: Nathan Sokalski | last post by:
I am a beginner with AJAX, and have managed to learn how to use it when passing single parameters, but I want to return more than one value to the client-side JavaScript function that displays it. My client-side JavaScript function takes 4 parameters (which are expected to be integers). The idea of passing a single parameter and parsing it on the client has occurred to me, but since I am sure I am not the only person who has situations that...
4
1402
by: johntilster | last post by:
Here is a nice little Ajax application, which works fine in Firefox: http://www.minds.nuim.ie/~dez/js-test/ajax/ But it doesn't work in Opera! At least not in Opera 7.54, which I tested. I took a closer look and found that XmlHttpRequest is undefined. Is there a workaround? From what version on is that defined? Thanks!
1
1564
by: 47computers | last post by:
I have a couple of DropDownLists in a DetailsView control (your classic country/state lists) and I need one to be populated based on the current selection of the other. Currently this works fine with a postback, but an AJAX solution would be a better way of doing things. I've been googling around for some examples and tutorials, but so far nothing is working. I'm really a beginner with AJAX and need a simple example or tutorial for...
15
4190
by: JohnDriver | last post by:
Hello I am learning Ajax and I am following the tutorials found but for some reason, my code is not working. I think I am missing something in the code that I am posting below. Please have a look and let me know. <html> <head> <script> function submitForm() { var test;
3
1226
by: asmon | last post by:
I'm a PHP programmer but i'm pretty messed up at this moment with the following script. I have a page with a 'TEXTAREA' and a 'PLAY' text. when i click PLAY, values are being displayed in the TEXTAREA with a delay of a second. the values are stored in array, if for example i have an array with the values (2,5,7,8) then it will first show 2, after a second 4 and so on... the values are being set using PHP, then i convert the php array into...
12
1637
by: Justn226 | last post by:
hi, I am a beginner with AJAX, i have an assignment where I have to pass a number to my php script and have it sent back converted into CELCIUS OR FARENHEIHT(spelled wrong). The problem is I dont know how to pass multiple arguments to my php script... Here is my stuff below if you can look at it and someone could help me i would appreciate it... HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...
2
2247
by: malcster2 | last post by:
hello, i am a beginner to ajax. i have created a mysql database, which i would like to access from a web page. i have created 3 files, a html to display the data, a php file to extract the data, and a javascript file to to the clever stuff. when i access the html page, all the data is displayed correcty, but if i add or delete any records, and press the button i have created to refresh the data(without reloading), the data doesn't change....
3
3375
by: pablosuk78 | last post by:
Dear coders, I'm facing a problem and after few research I found that many ppl were looking around for the same solution, hope someone more expert than me could give a good help. I created an AJAX function that i.e. on click does a request to a server and show into a specified tag the results (well until here is something eveyone would do with AJAX)... the point is that the result is something like the this: i.e. <!-- this is the...
0
9026
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.