tag:blogger.com,1999:blog-70881776988627346212024-03-12T22:29:05.503-04:00Partial UpdatePartial Update,ajaxamenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.comBlogger229125tag:blogger.com,1999:blog-7088177698862734621.post-2797605960433336932012-03-28T20:11:00.001-04:002012-03-28T20:11:47.237-04:00Page with AJAX controls posts back twice to the server<p>I have a form containing three AJAX UpdatePanels, two of which contain a pair of listboxes and a pair of buttons, with the third one containing a pair of radio buttons in a radiobutton list and either three CascadingDropDown lists or two CascadingDropDown lists and a textbox depending on which radio button is selected. The only other control on my form is a button to submit the information on the form to the server.</p><p>One thing I've noticed is the information gets posted back to the server twice when the button is clicked. This causes a duplicate record to be written to two tables and a SQL exception being thrown when it tries to write a duplicate record to a third table since it violates that table's primary key constraint. At first, I thought the cause might've been due to the submit button being contained in the third UpdatePanel I mentioned, so I removed it from there and placed it by itself ... but the problem still occurs. One other thing I've noticed is that when data for one of the UpdatePanels is to be updated via a postback to the server, the other two UpdatePanels act as if they're also being posted back to the server; in other words, all three panels noticeably flicker simultaneously. I have a sneaking suspicion this may somehow tie into my entire page being posted back twice when the submit button is clicked, but I'm not at all sure.</p><p>What can I do to prevent my page from being posted back twice?</p><p>Hi,</p><p>any sync postback at the server side is almost identical to regual postback including:</p><p>- all control values are posted to the server<br/>- Viewstate is transferred to the server and back</p><p>The most important difference is in the rendering phass: only update panels are rendered and their content transferred to the client</p><p>So, you must design your application in such a way, that removing all update panels will not break server logic. UpdatePanels reduce flickering, but they don't change how server code process data.</p><p>-yuriy</p><br /><p>I think there a couple things that can cause this... I think ImageButtons can get rendered as "Submit" buttons, and have a __doPostBack call attached to their OnClick, which seems to make a double postback. Also, I think a button has a UseSubmitBehavior property... try setting that to false.</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-46039255581249321502012-03-28T20:11:00.000-04:002012-03-28T20:11:09.444-04:00Page with update panel doesnt show correct information when I back into the page<p>I have this page that I'd like to use update panels on. There are three controls on the page. I'd like to have the first dropdown control fire a second dropdown and then that one fire a gridview. I'd like the 2nd dropdown and the gridview to be in update panels. So when a user makes a general category selection in the first dropdown, the 2nd one will list the more specific categories (those related to the first dropdown selection) and then when the user picks a more specific category the gridview is filled with with data specific to that 2nd more specific category. I've got this all working fine. The the user clicks the "details" link in the gridview and they see full details about their selection from the gridview. But then when they click the "back" button in their browser, it takes them back to the page with the 2 dropdowns and the gridview but it's not in the state they left it. Ideally, they should see the same thing they saw before they clicked the "details" link.... their first selection int he first dropdown, their more specific category in the 2nd dropdown and the gridview filled with info relating to that 2nd dropdown. But that's not what I get. What am I missing?</p><p>hello.</p><p>well, you're not missing anything. it's simply the way ajax pages work. i think that you should take a look at the history control available on the future bits</p><p>http://msmvps.com/blogs/luisabreu/archive/2007/05/07/may-future-bits-the-history-control.aspx</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-90712920174179946072012-03-28T20:10:00.000-04:002012-03-28T20:10:27.711-04:00Page.ClientScript.RegisterStartupScript in updatepanel problem with Beta1.0 ??<p>Open a new window fails!!! (but with CTP OK!) </p><p> protected override void OnClick(EventArgs e)<br/> {<br/> if (grid != null && grid.DataKeyNames.Length > 0)<br/> {<br/> int[] selected = grid.GetSelectedIndexes();<br/> if (selected.Length > 0)<br/> {<br/> grid.SelectedIndex = selected[0];<br/> DataKey dataKey = grid.SelectedDataKey;<br/> if (dataKey != null)<br/> {<br/> string separator1;<br/> if (DialogNavigateUrl.ToString().IndexOf("?") != -1)<br/> {<br/> separator1 = "&";<br/> }<br/> else<br/> {<br/> separator1 = "?";<br/> }<br/> StringBuilder sb = new StringBuilder();<br/> string separator2 = string.Empty;<br/> IDictionaryEnumerator enumerator = dataKey.Values.GetEnumerator();<br/> while (enumerator.MoveNext())<br/> {<br/> sb.Append(separator2);<br/> sb.Append(enumerator.Key);<br/> sb.Append("=");<br/> sb.Append(enumerator.Value);<br/> separator2 = "&";<br/> }<br/> string format;<br/> format = "window.open('{0}{5}{6}{7}Parent={4}',null,'height={1},width={2},status=1,toolbar=0,menubar=0,location={3},resizable=1,scrollbars=1');";<br/> string script =<br/> String.Format(CultureInfo.CurrentCulture, format, DialogNavigateUrl.ToString().Replace("~/", ""), DialogHeight.Value, DialogWidth.Value,<br/> Convert.ToByte(DialogLocation), this.ClientID, separator1, sb.ToString(), separator2);<br/> Type type = this.GetType();<br/> if (!Page.ClientScript.IsStartupScriptRegistered("clientScript"))<br/> {<br/> Page.ClientScript.RegisterStartupScript(type, "clientScript", script, true);<br/> }<br/> }<br/> }<br/> }<br/> base.OnClick(e);<br/> }</p><p> </p><p> </p><p>For the control to work inside an UpdatePanel you need to call the new static registration APIs on the ScriptManager class. They have basically the same parameters as the Page.ClientScript methods but the new first parameter is the control doing the registration (usually "this").</p><p>Thanks,</p><p>Eilon</p><br /><p>More info about script registration in my recent post:http://forums.asp.net/thread/1440058.aspx</p><p>Thanks,</p><p>Eilon</p><p> </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-34133488899995734512012-03-28T20:09:00.000-04:002012-03-28T20:09:45.515-04:00Page.ClientScript.RegisterStartupScript in Ajax beta 2<p>----Code in Module (app_code) folder</p><p>Public Sub ShowMessage(ByVal msg As String, ByVal ObjPage As Page)</p><p>Try<br/>Dim RegKeyname As String = "infmsg"<br/>If ObjPage.ClientScript.IsStartupScriptRegistered(RegKeyname) Then</p><p> RegKeyname = RegKeyname & Now.GetHashCode.ToString("x")<br/>Else<br/> RegKeyname = "infmsg"<br/>End If</p><p>ObjPage.ClientScript.RegisterStartupScript(ObjPage.GetType, RegKeyname, String.Format("alert('{0}');", msg), True)</p><p><br/>Catch ex As Exception</p><p>End Try</p><p>End Sub</p><p>----------</p><p>I used to call this function from any of my asp.net Pages to display an alert message this worked till atlas july ctp now it doenst seem to work in ajax beta 2.</p><p>Note : This worked in Normal Pages as well as Pages having an Update panel</p><p>Any one any clue ... how to get it back to work</p><p> </p><p>Hi Asifsolkar</p><p>I think you should use ScriptManger'sRegisterStartupScript method. There was change between CTP and BETA versions of ASP.NET AJAX ext.</p><p>(seehttp://ajax.asp.net/docs/mref/8b90a607-02c9-3c22-6cec-4628c98ccd25.aspx )</p><p>Have a nice day</p><p> Milo</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-12162886368937219922012-03-28T20:08:00.001-04:002012-03-28T20:08:52.846-04:00Page.IsCallback equivalent<p>What is the Atlas equivalent to the value returned by Page.IsCallback?</p><p>As I understand it, since the call is just an intercepted postback, Page.IsPostBack will be True on an Atlas callback. I don't think there is a way to tell if you're dealing with a "True" PostBack or a callback, but I also don't think the event could be called more than one way, so if you need to check later on in your code how you got to where you are, set a member variable in the event handler.</p><br />ScriptManager.GetCurrent(Page).IsInPartialRenderingMode<br /><p>Thanks folks. I had noticedIsInPartialRenderingMode and found it seems to do the job. I do need a definitive answer as it affects how I create my products. Can anyone of the Atlas team chime in?</p><br /><p>hello.</p><p>as you can see, i'm not in the atlas team. however, i'd like to confirm Rama's answer. btw, currently, a partial postaback is identified by a header called delta which has its value set to true during a partial postback. during the init event, the scriptmanager control looks for that header, and when it has the value true, it initializes the _inPartialRenderingMode field which is used to "feed" the result of the IsInPartialRenderingMode property.</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-19609084788485124792012-03-28T20:08:00.000-04:002012-03-28T20:08:12.012-04:00Page.Redirect From Control Event Using Atlas<p>I am a newbie in atlas..just a couple of hour of experience.</p><p>I've managed to create a simple project with sucess, and all works well. But, in a certain event of an treeview control, the "SelectedNodeChanged", i need to redirect the page to another URL. The Page.Redirect runs it the server, but the page doesn't do the postback. How can i force the postback, in a certain event?</p><p>Thank you very much.</p><p>Well...i found out that the Page.Redirect in Atlas doesn't work very well.</p><p>I've got this solution, it's not the best way to do this, but it works,</p><p>Page.ClientScript.RegisterStartupScript(this.GetType(),"redirect",@."window.location.href='default.aspx';",true)</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-74923759338092137502012-03-28T20:07:00.000-04:002012-03-28T20:07:26.499-04:00Page.RegisterClientScriptBlock breaks Ajax?<p>Hi -</p>I am using<p>Page.RegisterClientScriptBlock to write a script dynamically to my webpage. For some reason, this seems to break some of my other java script (don't get called at all).</p><p> I'd be grateful for any idea experience with this!!! Thanks!!!!</p><p> </p><p>Oliver</p><p>You want to use the ScriptManager version of that same method instead, the Page's version doesn't work withthe ajax framework.</p><br /><p>Paul -</p><p> thanks so much. This was quite useful. May I ask you a follow-up question? While Ajax now works on the page, one additional control that loads its Javascript from a file still doesn't ... is there anything special I need to consider?</p><p> Thanks again,</p><p> Oliver </p><br /><p>Well, if that control doesn't load the file through the scriptmanager, that'll be a problem for you as well. What's the control? Also, any .js files need to have a line at the end of them:</p><p> if(Sys && Sys.Application)<br/> Sys.Application.notifyScriptLoaded();</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-73636899105311355652012-03-28T20:06:00.000-04:002012-03-28T20:06:02.157-04:00Page_Load and ajax<p>I have a simple question. when I use an UpdatePanel control, it is not supposed to refresh the page entirely, only a part of the page.</p><p>But why it calls Page_Load event ?</p><p>Here's the example used :</p><p> </p><p><!-- <Snippet2> --><br/><%@dotnet.itags.org. Page Language="C#" %<br/><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br/> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"<br/><script runat="server"><br/> protected void Page_Load(object sender, EventArgs e)<br/> {<br/> }<br/> protected void Search_Click(object sender, EventArgs e)<br/> {<br/> SqlDataSource1.SelectParameters["SearchTerm"].DefaultValue =<br/> Server.HtmlEncode(SearchField.Text);<br/> Label1.Text = "Searching for '" +<br/> Server.HtmlEncode(SearchField.Text) + "'";<br/> }<p> protected void ExampleProductSearch_Click(object sender, EventArgs e)<br/> {<br/> SqlDataSource1.SelectParameters["SearchTerm"].DefaultValue =<br/> Server.HtmlEncode(ExampleProductSearch.Text);<br/> Label1.Text = "Searching for '" +<br/> Server.HtmlEncode(ExampleProductSearch.Text) + "'";<br/> SearchField.Text = ExampleProductSearch.Text;<br/> }<br/></script<br/><html xmlns="http://www.w3.org/1999/xhtml"><br/><head id="Head1" runat="server"><br/> <title>UpdatePanel Trigger Example</title><br/> <style type="text/css"><br/> body {<br/> font-family: Lucida Sans Unicode;<br/> font-size: 10pt;<br/> }<br/> button {<br/> font-family: tahoma;<br/> font-size: 8pt;<br/> }<br/> </style><br/></head><br/><body><br/> <form id="form1" runat="server"<br/> defaultbutton="SearchButton" defaultfocus="SearchField"><br/> <div><br/> <asp:ScriptManager ID="ScriptManager1" runat="server" /><br/> <br/> Search for products in the Northwind database. For example,<br/> find products with<br/> <asp:LinkButton ID="ExampleProductSearch" Text="Louisiana" runat="server" OnClick="ExampleProductSearch_Click"><br/> </asp:LinkButton> in the title. <br /><br /><br/> <asp:TextBox ID="SearchField" runat="server"></asp:TextBox><br/> <asp:Button ID="SearchButton" Text="Submit" OnClick="Search_Click"<br/> runat="server" /> <br/> <br/><asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional"<br/> runat="server"><br/> <Triggers><br/> <asp:AsyncPostBackTrigger ControlID="SearchButton" /><br/> </Triggers><br/> <ContentTemplate><br/> <br/> <asp:Label ID="Label1" runat="server"/><br/> <br /><br/> <asp:GridView ID="GridView1" runat="server" AllowPaging="True"<br/> AllowSorting="True" DataSourceID="SqlDataSource1"><br/> <EmptyDataTemplate><br/> No results to display.<br/> </EmptyDataTemplate><br/> </asp:GridView><br/> <asp:SqlDataSource ID="SqlDataSource1" runat="server"<br/> ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename='H:\Program Files\Microsoft ASP.NET\ASP.NET AJAX Sample Applications\v1.0.61025\Contacts\App_Data\Contacts.mdf';Integrated Security=True;User Instance=True"<br/> SelectCommand="SELECT [Location] FROM<br/> Contacts WHERE ([FirstName] LIKE<br/> '%' + @dotnet.itags.org.SearchTerm + '%')"><br/> <SelectParameters><br/> <asp:Parameter Name="SearchTerm" Type="String" /><br/> </SelectParameters><br/> </asp:SqlDataSource><br/> <br/> </ContentTemplate><br/> </asp:UpdatePanel> <p> </div><br/> </form><br/></body><br/></html><br/><!-- </Snippet2> --></p><p>Here's some background info:<br/>http://ajax.asp.net/docs/Overview/intro/partialpagerendering/updatepanelOverview.aspx (see third section on How UpdatePanel's Work)<p>Basically, during an async postback, the full server page life cycle is executed to the point of rendering similar to a "regular" postback. At the render phase for an async postback the framework determines that only the content of UpdatePanels need to be refreshed.</p><p>If you want to not run code during an async postback, use the ScriptManager.IsInAsyncPostBack to check if you are in async postback and then take action.</p><p>http://ajax.asp.net/docs/mref/db2bbeac-e762-e1ac-ca74-1a3e6ab76979.aspx</p><p> </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-26291430985071774912012-03-28T20:05:00.000-04:002012-03-28T20:05:15.715-04:00Page_Load always executed - can this be changed?<p>Hello,</p><p>I started using <asp:UpdatePanel> to update controls content in my page.</p><p>This work really great, and the Look and Feel are perfect.</p><p>However, in the page I load many controls dynamically in the Page_Load - it can reach thousands of controls.</p><p>Each of the controls contains UpdatePanel that has UpdateMode of "Conditional" - this let me change the contents of each control without affecting the other controls.<b>But</b>, and here finally come the catch, I noticed the whole Page_Load is executed. When there will be thousands of controls, I would like to Load them only once, then have AJAX code that would not cause the whole Page_Load to run again.</p><p> Is this possible? Can we make the AJAX read other page maybe?</p><p>Thanks in advance. :)</p>If you want to only run the code on the initial Page Load, you can throw everything in if(!Page.IsPostBack && !Page.IsCallBack). We use that method for most stuff, but if you use 3rd party controls, there may be some issues... We use telerik controls and they do a post back like event, which isn't caught by that.<br /><p>Well, if I add if (!Page.IsPostBack) then the controls are lost, as they're not static in the page but rather created on the fly using Page.LoadControl method.</p><p>What I'm trying to achieve is that different page will be called by the AJAX "engine". So far my investigations on this bore no fruit. Any ideas?<br/></p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-22524106957582463722012-03-28T20:04:00.000-04:002012-03-28T20:04:31.988-04:00Page_Validators in AJAX.NET problem.<p>Good day,</p><p>Using ASP.NET 2.0 AJAX Extensions 1.0 (1.0.61025) I am getting different output from my dev environment and another Windows 2003 server. It is causing a null reference exception because of the absence of some script, as follows.<br/></p><p>A page that demonstrates the problem. Essentially a Textbox with a Validator in an UpdatePanel. The Textbox is hidden in a partial page update and the validator isn't removed from Page_Validators, leading to a null reference exception. Here it is.<br/></p><pre class="coloredcode"><b id="1">1</b><%@dotnet.itags.org. Page Language="C#" %><br/><b id="2">2</b><html xmlns="http://www.w3.org/1999/xhtml"><br/><b id="3">3</b><head><br/><b id="4">4</b><title>AJAX Test</title><br/><b id="5">5</b><script runat="server"><br/><b id="6">6</b> protected void Button1_Click(object sender, EventArgs e)<br/><b id="7">7</b> {<br/><b id="8">8</b> TextBox1.Visible = false;<br/><b id="9">9</b> }<br/><b id="10">10</b></script><br/><b id="11">11</b></head><br/><b id="12">12</b><body><br/><b id="13">13</b> <form id="form1" runat="server"><br/><b id="14">14</b> <div><br/><b id="15">15</b><br/><b id="16">16</b> <asp:ScriptManager ID="ScriptManager1" runat="server" /><br/><b id="17">17</b> <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><br/><b id="18">18</b> <asp:TextBox ID="TextBox1" runat="server" /><br/><b id="19">19</b> <asp:RequiredFieldValidator ID="req" runat="server" ControlToValidate="TextBox1">Bad!</asp:RequiredFieldValidator><br/><b id="20">20</b> <br /><br/><b id="21">21</b> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" /><br/><b id="22">22</b> </ContentTemplate></asp:UpdatePanel><br/><b id="23">23</b><br/><b id="24">24</b> </div><br/><b id="25">25</b> </form><br/><b id="26">26</b></body><br/><b id="27">27</b></html><br/></pre><pre class="coloredcode">Here is the output from the dev environment that works:</pre> <pre class="coloredcode"><b id="1">1</b><html xmlns="http://www.w3.org/1999/xhtml"><br/><b id="2">2</b><head><br/><b id="3">3</b><title>AJAX Test</title><br/><b id="4">4</b><b id="5">5</b></head><br/><b id="6">6</b><body><br/><b id="7">7</b> <form name="form1" method="post" action="ajaxTest.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1"><br/><b id="8">8</b><div><br/><b id="9">9</b><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><br/><b id="10">10</b><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><br/><b id="11">11</b><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEzMDMxMDUwMDhkZDuvWiPpfDn3oBIdbrlUSDkq1FdR" /><br/><b id="12">12</b></div><br/><b id="13">13</b><b id="14">14</b><script type="text/javascript"><br/><b id="15">15</b><!--<br/><b id="16">16</b>var theForm = document.forms['form1'];<br/><b id="17">17</b>if (!theForm) {<br/><b id="18">18</b> theForm = document.form1;<br/><b id="19">19</b>}<br/><b id="20">20</b>function __doPostBack(eventTarget, eventArgument) {<br/><b id="21">21</b> if (!theForm.onsubmit || (theForm.onsubmit() != false)) {<br/><b id="22">22</b> theForm.__EVENTTARGET.value = eventTarget;<br/><b id="23">23</b> theForm.__EVENTARGUMENT.value = eventArgument;<br/><b id="24">24</b> theForm.submit();<br/><b id="25">25</b> }<br/><b id="26">26</b>}<br/><b id="27">27</b>// --><b id="28">28</b><b id="29">29</b></script><br/><b id="30">30</b><b id="31">31</b><b id="32">32</b><script src="/WebResource.axd?d=aw9IrFUp2_oQ8Owgb8KfHw2&t=633198061661875000" type="text/javascript"></script><br/><b id="33">33</b><b id="34">34</b><b id="35">35</b><script src="/ScriptResource.axd?d=CKqJO5pnLiMiiKIAPSjUhlVSq_XssPmgCzQ3imV6c-ZI8ou-jtF3g7zNM6zAzFuwj0cj4E-Yc9RTfjMvluxK4g2&t=633198061661875000" type="text/javascript"></script><br/><b id="36">36</b><script src="/ScriptResource.axd?d=cKz-vvqLo1ehaWyVHnXCamccZCS0TLr_WkNiTAu40bnCXSUBzVyHwrKIRYpIqnRFj0bnuLFtFlIG1uLE2IU0HlTdJFkwvyWnrxefUsmR0881&t=633278094321250000" type="text/javascript"></script><br/><b id="37">37</b><script src="/ScriptResource.axd?d=cKz-vvqLo1ehaWyVHnXCamccZCS0TLr_WkNiTAu40bnCXSUBzVyHwrKIRYpIqnRFj0bnuLFtFlIG1uLE2IU0HjrmGHRUhUO2-euEh4H2gbI1&t=633278094321250000" type="text/javascript"></script><br/><b id="38">38</b><script type="text/javascript"><br/><b id="39">39</b><!--<br/><b id="40">40</b>function WebForm_OnSubmit() {<br/><b id="41">41</b>if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;<br/><b id="42">42</b>return true;<br/><b id="43">43</b>}<br/><b id="44">44</b>// --><b id="45">45</b></script><br/><b id="46">46</b><b id="47">47</b> <div><br/><b id="48">48</b><b id="49">49</b> <script type="text/javascript"><br/><b id="50">50</b>//<![CDATA[<b id="51">51</b>Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));<br/><b id="52">52</b>Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);<br/><b id="53">53</b>//]]><br/><b id="54">54</b></script><br/><b id="55">55</b><b id="56">56</b> <div id="UpdatePanel1"><br/><b id="57">57</b><br/><b id="58">58</b> <input name="TextBox1" type="text" id="TextBox1" /><br/><b id="59">59</b> <span id="req" style="color:Red;visibility:hidden;">Bad!</span><br/><b id="60">60</b> <br /><br/><b id="61">61</b> <input type="submit" name="Button1" value="" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Button1", "", true, "", "", false, false))" id="Button1" /><br/><b id="62">62</b><br/><b id="63">63</b><b id="64">64</b></div><br/><b id="65">65</b><b id="66">66</b> </div><br/><b id="67">67</b><br/><b id="68">68</b><script type="text/javascript"><br/><b id="69">69</b><!--<br/><b id="70">70</b>var Page_Validators = new Array(document.getElementById("req"));<br/><b id="71">71</b>// --><b id="72">72</b></script><br/><b id="73">73</b><b id="74">74</b><script type="text/javascript"><br/><b id="75">75</b><!--<br/><b id="76">76</b>var req = document.all ? document.all["req"] : document.getElementById("req");<br/><b id="77">77</b>req.controltovalidate = "TextBox1";<br/><b id="78">78</b>req.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";<br/><b id="79">79</b>req.initialvalue = "";<br/><b id="80">80</b>// --><b id="81">81</b></script><br/><b id="82">82</b><b id="83">83</b><div><br/><b id="84">84</b><b id="85">85</b><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKV1JT3DQLs0bLrBgKM54rGBh9lq902q1zs4nZQoQSzXWrrFvC2" /><br/><b id="86">86</b></div><br/><b id="87">87</b><b id="88">88</b><script type="text/javascript"><br/><b id="89">89</b><!--<br/><b id="90">90</b>var Page_ValidationActive = false;<br/><b id="91">91</b>if (typeof(ValidatorOnLoad) == "function") {<br/><b id="92">92</b> ValidatorOnLoad();<br/><b id="93">93</b>}<br/><b id="94">94</b><b id="95">95</b>function ValidatorOnSubmit() {<br/><b id="96">96</b> if (Page_ValidationActive) {<br/><b id="97">97</b> return ValidatorCommonOnSubmit();<br/><b id="98">98</b> }<br/><b id="99">99</b> else {<br/><b id="100">100</b> return true;<br/><b id="101">101</b> }<br/><b id="102">102</b>}<br/><b id="103">103</b>// --><b id="104">104</b></script><br/><b id="105">105</b><br/><b id="106">106</b><script type="text/javascript"><br/><b id="107">107</b><!--<br/><b id="108">108</b>Sys.Application.initialize();<br/><b id="109">109</b><b id="110">110</b><b>document.getElementById('req').dispose = function() {<br/></b><b id="111">111</b><b> Array.remove(Page_Validators, document.getElementById('req'));<br/></b><b id="112">112</b><b>}</b><br/><b id="113">113</b>// --><b id="114">114</b></script><br/><b id="115">115</b></form><br/><b id="116">116</b></body><br/><b id="117">117</b></html><br/><b id="118">118</b></pre><p> Here is output from a different server that fails.</p><p> </p><pre class="coloredcode"><b id="1">1</b><html xmlns="http://www.w3.org/1999/xhtml"><b id="2">2</b><head><b id="3">3</b><title>AJAX Test</title><b id="4">4</b><b id="5">5</b></head><b id="6">6</b><body><b id="7">7</b> <form name="form1" method="post" action="ajaxTest.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1"><b id="8">8</b><div><b id="9">9</b><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><b id="10">10</b><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><b id="11">11</b><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEzMDMxMDUwMDhkZBFseLlnE6oRW+2WytSmHIxuhR3k" /><b id="12">12</b></div><b id="13">13</b><b id="14">14</b><script type="text/javascript"><b id="15">15</b><!--<b id="16">16</b>var theForm = document.forms['form1'];<b id="17">17</b>if (!theForm) {<b id="18">18</b> theForm = document.form1;<b id="19">19</b>}<b id="20">20</b>function __doPostBack(eventTarget, eventArgument) {<b id="21">21</b> if (!theForm.onsubmit || (theForm.onsubmit() != false)) {<b id="22">22</b> theForm.__EVENTTARGET.value = eventTarget;<b id="23">23</b> theForm.__EVENTARGUMENT.value = eventArgument;<b id="24">24</b> theForm.submit();<b id="25">25</b> }<b id="26">26</b>}<b id="27">27</b>// --><b id="28">28</b><b id="29">29</b></script><b id="30">30</b><b id="31">31</b><b id="32">32</b><script src="/WebResource.axd?d=y79a8WX0nIrEh3fkGSsX9A2&t=633281399937474336" type="text/javascript"></script><b id="33">33</b><b id="34">34</b><b id="35">35</b><script src="/WebResource.axd?d=w26mxAmgRXp-rT77oPfALL7gzYUT-X6oWLHzd_D6LjY1&t=633281399937474336" type="text/javascript"></script><b id="36">36</b><script src="/ScriptResource.axd?d=wZTJCSpVLa8cXWFJgmiuXX-hnAsgClz1-CgGif5xa_-p3CzrOtmsIfh3Y28aQcYFVC5wnr2IJhBHoh2c9Zc0Ch0RynufR4TLZTewW0cBhsc1&t=633281590101841744" type="text/javascript"></script><b id="37">37</b><script src="/ScriptResource.axd?d=wZTJCSpVLa8cXWFJgmiuXX-hnAsgClz1-CgGif5xa_-p3CzrOtmsIfh3Y28aQcYFVC5wnr2IJhBHoh2c9Zc0CrgGo9Nt84M88yWLG3iczXI1&t=633281590101841744" type="text/javascript"></script><b id="38">38</b><script type="text/javascript"><b id="39">39</b><!--<b id="40">40</b>function WebForm_OnSubmit() {<b id="41">41</b>if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;<b id="42">42</b>return true;<b id="43">43</b>}<b id="44">44</b>// --><b id="45">45</b></script><b id="46">46</b><b id="47">47</b> <div><b id="48">48</b><b id="49">49</b> <script type="text/javascript"><b id="50">50</b>//<![CDATA[<b id="51">51</b>Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));<b id="52">52</b>Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);<b id="53">53</b>//]]><b id="54">54</b></script><b id="55">55</b><b id="56">56</b> <div id="UpdatePanel1"><b id="57">57</b><b id="58">58</b> <input name="TextBox1" type="text" id="TextBox1" /><b id="59">59</b> <span id="req" style="color:Red;visibility:hidden;">Bad!</span><b id="60">60</b> <br /><b id="61">61</b> <input type="submit" name="Button1" value="" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Button1", "", true, "", "", false, false))" id="Button1" /><b id="62">62</b><b id="63">63</b><b id="64">64</b></div><b id="65">65</b><b id="66">66</b> </div><b id="67">67</b><b id="68">68</b><script type="text/javascript"><b id="69">69</b><!--<b id="70">70</b>var Page_Validators = new Array(document.getElementById("req"));<b id="71">71</b>// --><b id="72">72</b></script><b id="73">73</b><b id="74">74</b><script type="text/javascript"><b id="75">75</b><!--<b id="76">76</b>var req = document.all ? document.all["req"] : document.getElementById("req");<b id="77">77</b>req.controltovalidate = "TextBox1";<b id="78">78</b>req.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";<b id="79">79</b>req.initialvalue = "";<b id="80">80</b>// --><b id="81">81</b></script><b id="82">82</b><b id="83">83</b><div><b id="84">84</b><b id="85">85</b><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKvmrnGBwLs0bLrBgKM54rGBh5nv4YQrwGF0j7OWce2dFyfGsmj" /><b id="86">86</b></div><b id="87">87</b><b id="88">88</b><script type="text/javascript"><b id="89">89</b><!--<b id="90">90</b>var Page_ValidationActive = false;<b id="91">91</b>if (typeof(ValidatorOnLoad) == "function") {<b id="92">92</b> ValidatorOnLoad();<b id="93">93</b>}<b id="94">94</b><b id="95">95</b>function ValidatorOnSubmit() {<b id="96">96</b> if (Page_ValidationActive) {<b id="97">97</b> return ValidatorCommonOnSubmit();<b id="98">98</b> }<b id="99">99</b> else {<b id="100">100</b> return true;<b id="101">101</b> }<b id="102">102</b>}<b id="103">103</b>// --><b id="104">104</b></script><b id="105">105</b><b id="106">106</b><script type="text/javascript"><b id="107">107</b><!--<b id="108">108</b>Sys.Application.initialize();<b id="109">109</b>// --><b id="110">110</b></script><b id="111">111</b></form><b id="112">112</b></body><b id="113">113</b></html><b id="114">114</b></pre>The working machine is a dev machine with a long history of messing around.The failing machine is a freshly installed Windows 2003 install with only critical updates, .Net Framework 2.0, Ajax Extensions.I uninstalled and reinstalled Ajax Extensions on the dev machine using the same msi.<br/>I am unable to figure out what is different in the configuration.<p>Any suggestions would be tremendous!</p><p>Thanks,</p><p>Craig </p><p><br/></p><p>Validation controls, which includes theBaseCompareValidator,BaseValidator,CompareValidator,CustomValidator,RangeValidator,RegularExpressionValidator,RequiredFieldValidator, andValidationSummary control are not compatible with UpdatePanel</p><p>See it here</p><p>http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx</p><p>You can downlaod compatible ersion of validators from here</p><p>http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx</p><br /><p>Thanks muchly! :) </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-73608518387223705702012-03-28T20:03:00.001-04:002012-03-28T20:03:52.022-04:00Page_Validator undefined Error??<p>Hi,</p><p>I have a jscript function calledEnableAll(). The following is the Function:-</p> function EnableAll()<p>{</p>alert("Hai");<p>EnableAllValidators(false);</p><p>EnableValidator('valreq_Salutation',true);</p><p>ShowError();</p><p> </p><p>}</p><p> This i called on a button click. but only the alert message is pop_up. after that im getting this errorPage_Validators is undefined Jscript runtime error .</p><p>What was the solution for this??</p><p>How can i over come this...</p><p> Hi,</p><p>I'm not quite sure why you use this function. It seems you want to enable all validators on the page according to the name of the function.</p><p>The error is caused by an javascript exception, looks like it uses an object that doesn't exist internally. And I can't tell since I don't know your implementation in EnableAllValidators and EnableValidator function. You'd better use Visual Studio to debug your javascript to find out the reason and resolve it.<br/></p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-11545642098090718862012-03-28T20:03:00.000-04:002012-03-28T20:03:13.364-04:00Paged GridView in update panel doesnt work<p> Hi, I have paged grid view inside an update panel but when I try to change the page in the grid view nothing happens, any ideas why? thanks for your help.<br/></p><p>Could you post your code so we can see exactly what you are doing?</p><br /><p>Yes, here is the gridviewcode</p><p> <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="12" AutoGenerateColumns="False"><br/> <FooterStyle BackColor="White" ForeColor="#000066" /><br/> <RowStyle ForeColor="#000066" /><br/> <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /><br/> <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /><br/> <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /><br/> <Columns><br/> <asp:BoundField DataField="# Cuota" HeaderText="# Cuota" /><br/> <asp:BoundField DataField="Saldo Inicial" HeaderText="Saldo Inicial" /><br/> <asp:BoundField DataField="MontoInteres" HeaderText="Monto Interes" DataFormatString="{0:C}" HtmlEncode="False" /><br/> <asp:BoundField DataField="Monto Cuota" HeaderText="Monto Cuota" /><br/> <asp:BoundField DataField="MontoCapital" HeaderText="Monto Capital" DataFormatString="{0:C}" HtmlEncode="False" /><br/> </Columns><br/> </asp:GridView></p><p> </p><p>The grid view gets filled with data, it just wont let me browse through the grid view pages and it works outside the update panel. </p><br /><p>Nevermind, outside the update panel it just postbacks but I hadnt notice the information is the same. I dont have any eventhandler set on the gridview. </p><br /><p>I made it work. I just added this code</p><p><br/> protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)<br/> {<br/> <br/> GridView1.DataSource = ViewState["DataTable"] as DataTable ;<br/> GridView1.PageIndex = e.NewPageIndex;<br/> GridView1.DataBind();<br/> }</p><p> </p><p>Thanks for your help. </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-7447127294211842822012-03-28T20:02:00.000-04:002012-03-28T20:02:21.563-04:00PageError event of scriptmanager not firingI have a content page that has a master page. I have an updatepanel and a scriptmanger in my content page. I defined a handler for OnPageError for the scriptmanager and defined a error template for the scriptmanager but when I set the e.errormessage in the OnPageError event, but if I set a break point in the event, the break point is never reached and the error message in the template still displays 'unknown error' Any ideas?<p>if I put a button on the page and in the click event of the button i manually throw and error.</p><p>thrownewException("error button clicked");</p><p>the event fires and works fine.</p><p> </p><p>but if I put some invalid characters like '<img src' inside a textbox and then click the button (removing the throw) then the OnPageError isn't fired</p><p> </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-80316798404910910482012-03-28T20:01:00.001-04:002012-03-28T20:01:44.262-04:00PageError doesnt preserve stack trace<p>Hi,</p><p>I use the ScriptManager.PageError event in order to catch internal exceptions and rethrow them to be handled by the Application_Error event, just like in any non-ATLAS page.</p><p>The problem is that ATLAS clears the exception's stack trace and restarts it only from the PageError event handler itself.</p><p>I'm having hard time resolving the problems without having the original stack trace.</p><p>Any ideas?</p><p>Thanks,</p><p>Lior</p><p>hello.</p><p>are you sure about this? i seem to recall cehcking for a stack of an exception during the error handling...i maybe wrong since i don't have atlas installed here and can't check it right now...</p><br /><p>Yes, I created an exception inside a function of a UserControl I'm using in my page, and this is the stack trace of the e.Error exception returned by theScriptManager_PageError event.</p><p>As you can see, there is no stack trace before the PageError event. When not using ATLAS, the Server.GetLastError() function returns the original exception with the original stack trace as an InnerException.</p><p>at ***.Web.UI.***.TheScriptManager_PageError(Object sender, PageErrorEventArgs e) in ****.aspx.cs:line 179</p><p>at Microsoft.Web.UI.ScriptManager.OnPageError(PageErrorEventArgs e)</p><p>at Microsoft.Web.UI.ScriptManager.OnPageError(Exception ex)</p><p>at Microsoft.Web.UI.ScriptManager.OnPageError(Object sender, EventArgs e)</p><p>at System.Web.UI.TemplateControl.OnError(EventArgs e)</p><p>at System.Web.UI.Page.HandleError(Exception e)</p><p>at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</p><p>at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</p><p>Lior</p><br /><p>hello.</p><p>hum...here's an excerpt of a stack trace from an aspx on the error event of the scriptmanager:</p><p> at ASP.error.h(Object sender, EventArgs args) in d:\atlas\AtlasWebSite2\error.ascx:line 7<br/> at System.Web.UI.WebControls.Button.OnClick(EventArgs e)<br/> at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)<br/> at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)<br/> at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)<br/> at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)<br/> at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</p><p>as you can see, the error comes from an usercontrol which is inside an updatepanel,...</p><br /><p>Hi,</p><p>My mistake. I did a "throw e.Error" in the PageError handler which, of curse, cleared the stack trace...</p><p>Thanks for your help,</p><p>Lior</p><br />I have the same problem in my page, but your post don't solve my problem. I did the same thing you did and rethrow the exception e.Error in the Script Manager PageError event hadler but the exception is again catched by the atlas framwork not by the application error handler and a popup window shows with the exception. Why is this happening?<br /><p>hello.</p><p>well, if i recall correctly, scriptmanager catches all page erros and removes them so that the current request can be handled correctly. if it didn't do this, the client side would never receive the correct response (ie, the response wouldn't be in the correct format). if you need to log the error on the server, then handle the scriptmanager pageerror event and perform the loggin there. instead of showing the popup with the error, you can build your own error template which will be shown to the user in those cases...</p><br /><p>No this is not what I need. The problem is this: when an exception is thrown i my atlas page inside an update panel a javascript win pops up with an message "Unhadled exception". I don't want that! I want that exception to be catch from a httpHandler that uses the Server.GetLastError() method and shows a message in the ErrorPage.aspx. This is it. How can I do that?</p><p>I tried to do this like it is said in previous posts</p><p>ScriptManager1.PageError += new Microsoft.Web.UI.PageErrorEventHandler(sm_PageError); </p><p>protected void sm_PageError(object sender, Microsoft.Web.UI.PageErrorEventArgs e) {<br/> throw e.Error;<br/> }</p><p>but it doesn't work.<br/> </p><p> </p><br />I'm sorry the mistake was in my code. :)amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-66596729118601375212012-03-28T20:01:00.000-04:002012-03-28T20:01:02.164-04:00PageFlakes.com Initial LoadDoes anyone know how PageFlakes.com does the initial "Loading..." progress when you first go towww.pageflakes.com? I would like to be able to set a page to show a "Loading..." progress panel when users first go to the page.<p>I second that request - it may be flash, but it certainly is cool.</p><p>Also cool is the little dashes when you move a control around (denoting the size).</p><p>I also really wish the Atlas Tools team would come up with an RSS reader that was as robust as PageFlakes.</p><br />Well as far as I understood Pageflakes.com was done in Atlas that's why I was asking how they did the initial "loading" because I was hoping someone may be able to explain how to do something like that with Atlas.<br />I'm pretty sure they're using an UpdateProgress control with an animated GIF file. I'm also pretty sure that the GIF is included in the Atlas sample applications.<br />But how do you use an UpdateProgress control with the initial load of a page and not a PostBack--also, how did they make it so the UpdateProgress control replaces all of the UpdatePanels while loading?<br /><p>Look at my thread here:</p><p>http://forums.asp.net/thread/1256936.aspx</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-11305847656159137352012-03-28T20:00:00.000-04:002012-03-28T20:00:22.590-04:00pageLoad and pageUnload called when using PageMethods ?<p>I have pageLoad and pageUnload functions in my page where I do my initialization and cleanup. I also use UpdatePanels and PageMethods. I am noticing that pageLoad and pageUnload methods are getting called on every PageMethod (ajax) call !!.</p><p>Doesn't pageLoad and pageUnload correspond to window.load and window.unload events respectively ?</p><p>Basically, I want methods which should be called when _entire_ page is loaded or unloaded and should not be called while using PageMethods or postbacks from within UpdatePanel</p><p>Please guide.</p><p>Regards & thanks</p><p>Kapil </p><p> </p><p><br/>Hi ksachdeva17,</p><p>I hope i understand your situation correctly. You don't want that the page life cycle will be invoked when there is an event triggered by an action from a control inside your updatepanel (or trigger). Well the situation on the server will be the same when you're using an updatepanel. The async postback will take the same cycle as an synchronous postback. The thing that is different is the rendering of the page. The controls in your updatepanel will only be rendered and not the whole page. I hope this will make things clear for you.</p><p>Regards,</p><br /><p>Thanks Dennis,</p><p>You are saying that window.onload and window.unload (DOM) events will occur if we make XMLHttprequest from the page, I would guess they should not as XMLHttpRequest is independent of browser post !!. I understand that on server side async postback would take the same cycle as synchronous postback but on the page (in client browser) it should not.</p><p>Regards</p><p>Kapil</p><br /><p>Hi Kapil,</p><p>I was saying that the page life cycle on the server will stay the same no matter if it's a synchronous of asynchronous postback. I found this in the documentation of Ajax.</p><h2 class=subsectionTitle>Client Page Life-cycle Events</h2><p>During ordinary page processing in the browser, thewindow.onload DOM event is raised when the page first loads. Similarly, thewindow.onunload DOM event is raised when the page is refreshed or when the user moves away from the page.</p><p>However, these events are not raised during asynchronous postbacks. To help you manage these types of events for asynchronous postbacks, the PageRequestManager class exposes a set of events. These resemblewindow.load and other DOM events, but they also occur during asynchronous postbacks. For each asynchronous postback, all page events in the PageRequestManager class are raised and any attached event handlers are called.</p><p>Hope this helps!</p><p>Regards,</p><br /><p>Thanks Dennis,</p><p>So my inference is that pageLoad is not same as window.onload. If you could please verify my understanding. I think I should be able to add the event handler using $addHandler with 'load' as an event name to execute things when page is loaded for the first time (no async) . Correct ?</p><p>Regards</p><p>Kapil</p><br /><p>HI Kapil, </p><p>PageLoad and window.load are not the same indeed. you can handle also the logic you want in you code behind using thefollowing funciton:</p><p>if</p> (!ScriptManager.GetCurrent(this).IsInAsyncPostBack)<p>{</p><p>myTextBox.Text =</p>"Test";<p>}</p><p>Probably you already see what it's doing. It will check if it's in a asynchronous postback, when you want to handle some functionality when the page is in a synchronous postback you can you the statement above.</p><p>It is also possible to add a handeler to the load event of your window! like you suggested</p><p>Good luck</p><p>Regards,</p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-33034511111851411722012-03-28T19:59:00.001-04:002012-03-28T19:59:45.997-04:00pageLoad javascript function not being called<p>for some reason the javascript pageLoad method is not being called </p><p> the javascript is in scirbble.js</p><p>the example i have followed informs me that the pageLoad method should be ran when the atlas script manager control has loaded.</p><p>Is this corret.</p><p> Could someone please point me in the right direction for getting the below code to work<br/> </p><p> </p><p> </p><p> Below is the javascript and aspx code</p><p>function pageLoad()<br/>{<br/> var surface = document.getElementById("drawingSurface");<br/> image = surface.getElementsByTagName("IMG")[0];<br/> originalSrc = image.src;<p> surface.attachEvent("onmousedown", startStroke);<br/> surface.attachEvent("onmouseup", endStroke);<br/> surface.attachEvent("onmouseout", endStroke);<br/> surface.attachEvent("onmousemove", addPoints);<br/>}</p><p> </p><p>form id="form1" runat="server"><br/> <Atlas:ScriptManager ID="AtlasScriptManager" runat="server" ><br/> <Services><br/> <Atlas:ServiceReference Path="ScribbleService.asmx" /><br/> </Services><br/> <Scripts><br/> <Atlas:ScriptReference Path="ScriptLibrary\Scribble.js" /><br/> </Scripts><br/> </Atlas:ScriptManager><br/> <div id="drawingSurface"<br/> style="border:solid 1px black;height:200px;width:200px"><br/> <img alt="Scribble" src="http://pics.10026.com/?src=ScribbleImage.ashx"<br/> style="height:200px;width:200px" /><br/> </div><br/> </form><br/></p><p>i have the same problem since the last release. I had pageLoad() methods which were able to set elements on the initial loading which no longer fire automatically :?(</p><p>As a workaround, you can attach to thePageRequestManager events like so :</p><p> </p><p> </p><pre class="coloredcode"><script type="text/javascript"> Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoad);</script></pre><br /><p>when i do the above mentioned work around i get an error</p><p>'Sys.WebForms.PageRequestManager' is null or not an object</p><p> i have tried adding the script above and below the sript manager html elements but it makes no diffrence.</p><p>below is the aspx page</p><p>any help would glady be appreciated.</p><p><headrunat="server"></p><title>Atlas Scribble Sample</title><p></</p>head><body><formid="form1"runat="server"><Atlas:ScriptManagerID="AtlasScriptManager"runat="server"EnablePartialRendering=true><Services><Atlas:ServiceReferencePath="ScribbleService.asmx"/></Services><Scripts><Atlas:ScriptReferencePath="ScriptLibrary\Scribble.js"/></Scripts></Atlas:ScriptManager><divid="drawingSurface"style="border:solid 1px black;height:200px;width:200px"><imgalt="Scribble"src="ScribbleImage.ashx"style="height:200px;width:200px"/></div><scripttype="text/javascript"><p>Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoad);</p></script></form><p></</p>body><p></</p>html><br />throw an alert into your pageLoad() function to see if it's getting called; my guess is that it is, at least nothing you've posted here would prevent it. The issue I see is that the element 'surface' isn't going to respond to the attachEvent function as you have it written, at least not in this framework. You could try to us $addHandler(surface,'onmousedown',startStroke); instead.amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-31656798191926644562012-03-28T19:59:00.000-04:002012-03-28T19:59:12.368-04:00pageLoad fires before script references are loaded<p>I have an aspx page with:</p><p>- a scriptmanager that has 2 script references. Both scripts have the "if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();" line at their end.<br/></p><p>- a script section with a pageLoad function that calls a function defined in one of the 2 script references.<br/></p><p>- an iframe (with src set to about:blank).</p><p> </p><p>Result: </p><p>I get an "object undefined" error in the pageLoad function. with fiddler and in the debugger I can see that my script rerefences have not yet been loaded. As fas as I know, they should! It always worked until we added the iframe control. Removing the iframe control resolves the problem. To me this looks like an error in ajax where the pageLoad is executed on the load of the iframe contents instead of on the load of the main page.</p><p> </p><p>Anyone any suggestion? </p><p>Could you share some code that reproduces this bug? I was unable to get the behavior you describe.</p><p>Are you using a function named pageLoad? Or Sys.Application.add_load(...)? Or Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(...)? Code would help a lot.</p><br /><p>Thanks for looking into the problem. I will try to assemble a minimal solution that exposes the bug. BTW: it is a pageLoad function. In the debugger I saw that Ajax in the onload event looks if it exists and, if so, calls it. That's also how I found out that it gets called twice from this event handler. Give me some time to assemble the solution.</p><p> </p><p> Thanks agian,</p><p>Erwin<br/> </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-17126809012515793092012-03-28T19:58:00.000-04:002012-03-28T19:58:34.944-04:00PageMethod called within User Control (ascx)<p>Hi all,</p><p>I am trying to call a PageMethod on an AutoComplete extender within an ascx (user control). I am able to do so when the extender sits directly on an ASPX (web form) but would like to reuse the component.</p><p>I know to decorate the method with [WebMethod] and [ScriptMethod] attributes and also to make the method static. I know, too, that the parameter names must match the expected signature.</p><p>Is it possible to place Page Methods within User Controls or do they have to sit on ASPX pages?</p><p> </p><p>Thanks in advance,</p><p>MIKE </p>I have seen a couple of blog posts saying no and I was trying to do something similar last night and couldn't make it work. I would really perfer the AutoComplete extender and the NumericUpDown extender to have the option to fire events or at least non static methods but I don't think that will be possible under the current Ajax setup.amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-102327551381074422012-03-28T19:57:00.001-04:002012-03-28T19:57:49.791-04:00pagemethod call code sample<p>Can anyont point me to a code sample where a call is made to a server page method from the client script code?</p><p> </p><p>thanks!</p><p>Pratibha</p>Hi,<p>please checkthis post from my blog.amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-10766056272121503212012-03-28T19:57:00.000-04:002012-03-28T19:57:11.410-04:00pageLoaded event<p>I have created an ASP.NET custom server control that is updated using AJAX via an UpdatePanel using the Tick event of a Timer control as the asyc trigger. I need to execute javascript each time a partial postback returns so I am using the pageLoaded event. This works perfectly in IE7 but doesn't fire in Firefox 2.0.0.3 or Opera 9. On other browsers it never fires the pageLoaded event, but it does the AJAX updating and other javascript works. I am registering the client code during my control's render method.. I have also tried using the endRequest event. Please help. Why won't it work on other browsers.<pre class="coloredcode">Below is the rendered HTML:<!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><title>Untitled Page</title><meta content="text/html;charset=iso-8859-1" http-equiv="content-type" /><meta content="NO-CACHE" http-equiv="PRAGMA" /><meta content="NO-CACHE" http-equiv="CACHE-CONTROL" /><meta content="0" http-equiv="EXPIRES" /><style type='text/css'> a.info:active{z-index:0; position:relative; background-color:#FFF647} a.info label{display: none} a.info:active label{ display:inline; position:absolute; white-space:normal; text-wrap:normal; word-wrap:break-word; left:label.parent.width; top:label.parent.height; width:250px; border:1px solid #91907C; background-color:#EAE7C6; z-index:-1; } </style> </head><body> <form name="form1" method="post" action="Default.aspx" id="form1"><div><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEwMzQxMTA4OTkPZBYCAgMPZBYCAgEPZBYCAgIPZBYCZg9kFgJmDxYGHgtjZWxscGFkZGluZwUBMB4LY2VsbHNwYWNpbmcFATAeBXN0eWxlBSlwYWRkaW5nOjVweDt6LWluZGV4OjIwO3Bvc2l0aW9uOmFic29sdXRlO2RkMUSTfpjSwghJETl9/Jgkha9oZaA=" /></div><script type="text/javascript"><!--var theForm = document.forms['form1'];if (!theForm) { theForm = document.form1;}function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); }}// --></script><script src="/WebResource.axd?d=9DvoInn8tlftzCiBPvQagg2&t=632974035101093750" type="text/javascript"></script><script src="/ScriptResource.axd?d=WAnysv6JNp-Tgl_8AndGJnGXdfOUUPdccvGwkhkSJu2uP8RLi_go1jCrdTe0jCpJF0u8GYhfCflHcjQdOJTaXMeB6qn3C9aitPrPuScmgSM1&t=633063657262888841" type="text/javascript"></script><script src="/ScriptResource.axd?d=WAnysv6JNp-Tgl_8AndGJnGXdfOUUPdccvGwkhkSJu2uP8RLi_go1jCrdTe0jCpJF0u8GYhfCflHcjQdOJTaXOmCYkHGf_k8diSD9UcMEoc1&t=633063657262888841" type="text/javascript"></script><script src="/ScriptResource.axd?d=WAnysv6JNp-Tgl_8AndGJnGXdfOUUPdccvGwkhkSJu2uP8RLi_go1jCrdTe0jCpJF0u8GYhfCflHcjQdOJTaXLsHgXZk2LxHv8oSN-rIGKs1&t=633063657262888841" type="text/javascript"></script> <span id="events" style="font-size:Small;"><span id="events_timer1" style="visibility:hidden;display:none;"></span><input name="events$ctl00" type="hidden" id="events_ctl00" /><div id="events_UpdatePanel1"><table cellpadding="0" cellspacing="0" style="padding:5px;z-index:20;position:absolute;"><tr><td rowspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-bottom:5px;padding-top:5px;"><img src="../images/greenshd.gif" alt="The IT Road Show.........................." /></td><td style="padding-left:5px;">Tuesday 24 Apr</td><td style="padding-left:15px;">3:30 pm</td></tr><tr><td colspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-left:5px;padding-bottom:5px;"><a href="http://www.nova100.com.au" id="events_3160" EventsEventDatesId="3160" LabelId="events_label_0_3160" onfocus="document.getElementById('events_ctl00').value = this.LabelId" onblur="document.getElementById('events_ctl00').value = ''" class="info">The IT Road Show.......................... </a></td></tr><tr><td rowspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-bottom:5px;padding-top:5px;"><img src="../images/AKMAL_OVER.gif" alt="The Akmal Show" /></td><td style="padding-left:5px;">Tuesday 24 Apr</td><td style="padding-left:15px;">4:00 pm</td></tr><tr><td colspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-left:5px;padding-bottom:5px;"><a href="#" id="events_2749" EventsEventDatesId="2749" LabelId="events_label_1_2749" onfocus="document.getElementById('events_ctl00').value = this.LabelId" onblur="document.getElementById('events_ctl00').value = ''" class="info">The Akmal Show <label id="events_label_1_2749" style="text-decoration:none;">The Akmal Show with Kate Richie Weekdays 4pm-6pm.Akmal was born in Egypt - then moved to Australia. Akmal's mum doesn't think he's that funny - now the rest of Australia think he's ha haa hilarious.</label></a></td></tr><tr><td rowspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-bottom:5px;padding-top:5px;"><img src="../images/greenshd.gif" alt="The IT Road Show.........................." /></td><td style="padding-left:5px;">Wednesday 25 Apr</td><td style="padding-left:15px;">3:30 pm</td></tr><tr><td colspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-left:5px;padding-bottom:5px;"><a href="http://www.nova100.com.au" id="events_3161" EventsEventDatesId="3161" LabelId="events_label_2_3161" onfocus="document.getElementById('events_ctl00').value = this.LabelId" onblur="document.getElementById('events_ctl00').value = ''" class="info">The IT Road Show.......................... </a></td></tr><tr><td rowspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-bottom:5px;padding-top:5px;"><img src="../images/AKMAL_OVER.gif" alt="The Akmal Show" /></td><td style="padding-left:5px;">Wednesday 25 Apr</td><td style="padding-left:15px;">4:00 pm</td></tr><tr><td colspan="2" style="border-bottom-style:None;border-bottom-color:#91907C;border-bottom-width:thin;padding-left:5px;padding-bottom:5px;"><a href="#" id="events_2750" EventsEventDatesId="2750" LabelId="events_label_3_2750" onfocus="document.getElementById('events_ctl00').value = this.LabelId" onblur="document.getElementById('events_ctl00').value = ''" class="info">The Akmal Show <label id="events_label_3_2750" style="text-decoration:none;">The Akmal Show with Kate Richie Weekdays 4pm-6pm.Akmal was born in Egypt - then moved to Australia. Akmal's mum doesn't think he's that funny - now the rest of Australia think he's ha haa hilarious.</label></a></td></tr><tr><td rowspan="2" style="padding-bottom:5px;padding-top:5px;"><img src="../images/redshd.gif" alt="test add 25" /></td><td style="padding-left:5px;">Thursday 26 Apr</td><td style="padding-left:15px;">2:29 pm</td></tr><tr><td colspan="2" style="padding-left:5px;padding-bottom:5px;"><a href="k" id="events_136" EventsEventDatesId="136" LabelId="events_label_4_136" onfocus="document.getElementById('events_ctl00').value = this.LabelId" onblur="document.getElementById('events_ctl00').value = ''" class="info">test add 25 </a></td></tr></table></div></span> <script type="text/javascript">//<![CDATA[Sys.WebForms.PageRequestManager._initialize('ctl06', document.getElementById('form1'));Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tevents$UpdatePanel1'], ['events','events$timer1'], [], 90);//]]></script><script type="text/javascript"><!--Sys.Application.add_init(function() { $create(Sys.UI._Timer, {"enabled":true,"interval":1000,"uniqueID":"events$timer1"}, null, null, $get("events_timer1"));}); Type.registerNamespace('EventsManager'); var prm = Sys.WebForms.PageRequestManager.getInstance(); if (prm != null) { prm.add_endRequest(pageLoadedHandler); } function window.onload() { } function pageLoadedHandler(sender, args) { var hidden = document.getElementById('events_ctl00'); if (hidden != null) { var labelId = hidden.value; if (labelId.length > 0) { var lbl = document.getElementById(labelId); if (lbl != null) { lbl.parentElement.setActive(); } } } } Sys.Application.initialize();// --></script></form> </body></html></pre><p> </p><p> Below is my code for the Render method when I used the endRequest event:<pre class="coloredcode">protected override void Render(HtmlTextWriter writer) {base.Render(writer);//Add script and register it. Page.ClientScript.RegisterStartupScript(typeof(EventsManager),"script", @dotnet.itags.org." Type.registerNamespace('EventsManager'); var prm = Sys.WebForms.PageRequestManager.getInstance(); if (prm != null) { prm.add_endRequest(pageLoadedHandler); } function window.onload() { } function pageLoadedHandler(sender, args) { var hidden = document.getElementById('" + ClickedLinkLabelId.ClientID + @dotnet.itags.org."'); if (hidden != null) { var labelId = hidden.value; if (labelId.length > 0) { var lbl = document.getElementById(labelId); if (lbl != null) { lbl.parentElement.setActive(); } } } } ",true); }</pre><p> </p><p> </p><p>Hi,</p><p>Can you show me a stripped version of your control and a sample page using it?</p><p>It will be easier for us to trouble shooting. Thanks. </p><br /><p>Hi Raymond,</p><p>I really appreciate your offer of help, but I just figured out what the problem was. </p><p>My javascript code below was causing a problem for all the code in my script block on all browsers apart from IE.</p><p>Problem code:</p><p> function window.onload()<br/> {<br/> <br/> }<br/></p><p>When I changed it to the code below, it worked in all browsers.</p><p>Correct code: </p><p>window.onload = function()<br/>{<br/> document.getElementById('" + TimeZoneOffset.ClientID + @."').value = -(new Date().getTimezoneOffset());<br/>}</p><p> </p><p>Thanks again. </p><p> </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-2346802246520933652012-03-28T19:56:00.000-04:002012-03-28T19:56:14.940-04:00pageLoad() javascript function<p>I understand that a script with the pageLoad() function is a way to hook into the client side load event.</p><p>That works great if you are working in the .aspx page itself. What if you're in a user control and want something to hook into the pageLoad() event on the client?</p><p> I could use Page.RegisterClientScriptBlock() to inject the JS into the page, but that would overwrite any other function that might be in the master page, content page or other user controls.</p><p> Isn't there a way to just add an event to the page load on the client side and not worry about conflicting with other code?</p><p> Thanks,</p><p>John</p><p>Can you give an example of what you're trying to do?</p><br />I'm not sure I understand your problem, but if your user control inherits from Sys.UI.Control it's initialize method will be called when the page loads.<br /><p>You can add your own pageLoad() handler by usingSys.Application.add_load().<br/></p><br /><p>HI,</p><p>I could use the page_load server event, but that would delay the rendering of the entire page until this process is complete. The effect I am looking for is to render a page so the user has something to look at. Then, when the<em>client</em> on_load event fires, initiate some long running tasks that can take place while the user already has something to look at.</p><p>Thanks,</p><p>John</p><br /><p>Sys.Application.Load is the client side event, not server side. Take a look at the documentation I linked. That's the event that pageLoad() calls implicitly.<br/></p><br /><p>Hi,</p><p>In the User control , write this function ,<br/><script><br/>function IAMIntheUserControl(object,eventArgs) {<br/>}<br/></script></p><p>register this script with RegisterClientScriptBlock.</p><p>Sys.Application.add_load( IAMIntheUserControl );<br/> </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-11985430973201813542012-03-28T19:55:00.000-04:002012-03-28T19:55:22.286-04:00PageMethod problems<p>Hi Everyone -</p><p>I have a master page setup, and i would like to use ajax in one of the pages that are to be used as a content page.</p><p>In the javascript portion of the detail page, i have some procedures that are marked as webmethods</p><p> <pre class="coloredcode"> [WebMethod()]public void LoadGrid3() {#region LoadGrid3 DataSet ds3 =new DataSet(); DataTable dt3 = ds3.Tables.Add("Customer");</pre> <p>In the javascript side (presentation)</p><pre class="coloredcode">"javascript" type="text/javascript"> function findData() { var request; var AlertDiv = document.getElementById("AlertDiv"); AlertDiv.style.display =""; request = PageMethods.Update(onSearchComplete);} function onSearchComplete(results) { var AlertDiv = document.getElementById("AlertDiv"); AlertDiv.style.display ="none"; alert(results);} function findData_callback(res){ alert("here");}</pre></p><p> </p><pre class="coloredcode">script language="javascript" type="text/javascript"> function findData() { var request; var AlertDiv = document.getElementById("AlertDiv"); AlertDiv.style.display =""; request = PageMethods.Update(onSearchComplete);} function onSearchComplete(results) { var AlertDiv = document.getElementById("AlertDiv"); AlertDiv.style.display ="none"; alert(results);} function findData_callback(res){ alert("here");} script></pre><p> </p><pre class="coloredcode">"text/C#" runat="server"> [WebMethod]public void Update() { LoadGrid3(); }</pre><p>scripttype="text/C#"runat="server"></p><p>[WebMethod]<p>publicvoid Update()<p>{</p><p>LoadGrid3();</p><p>}</p></p></p><p>script></p> <p> </p><p> </p><p> </p><p>On the button click event - i have it call the function findData</p><p> </p><p>the PageMethods get popped as an error</p><p>Microsoft JScript runtime error: 'PageMethods' is undefined</p><p> </p><p> </p><p>Am i missing something somewhere??</p><p> </p><p>thanks</p><p>tony</p><p> </p><p> </p><p>Hi,</p><p>PageMethods must be declared as public static methods in beta1.<br/></p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-10165953908421866462012-03-28T19:54:00.001-04:002012-03-28T19:54:46.063-04:00PageMethod problem<p>HI. I have a problem with calling static PageMethod in asp.net ajax.</p><p>Problem apperars then i use UrlMappings. For example i have this code in web.config</p> <pre class="coloredcode"><urlMappings><br/><add url="~/ComputerManager/WorkstationList.aspx" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=1"/><br/><add url="~/ComputerManager/ServerList.aspx" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=2"/><br/></urlMappings></pre> and this code in ComputerList.aspx. cs <pre class="coloredcode">[WebMethod]<br/>public static string SetSelection(string ID,string dataKey,bool state)<br/>{<br/> ...<br/>}</pre><p> </p><p>so, when call PageMethods.SetSelection(...) a have a error "The server method SetSelection is failed".</p><p>post url ends with WorkstationList.aspx/SetSelection<br/></p><p>any ideas? </p><p>Hi,</p><p>You are rewriting your URL, and these URL are fixed one. They don't cater for any extra items or query string parameters. Thats why they don't map to actual page when you want to do that. In this case I will recommend that you add another entry with following items</p><p> </p><pre class="coloredcode"><urlMappings><add url="~/ComputerManager/WorkstationList.aspx" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=1"/><add url="~/ComputerManager/ServerList.aspx" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=2"/><add url="~/ComputerManager/WorkstationList.aspx/SetSelection" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=1"/><add url="~/ComputerManager/ServerList.aspx/SetSelection" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=2"/></urlMappings></pre><br /><p>Then i use mappings like you suggested, i get a request to pageComputerList.aspx with parametercomp_type=1, insted of calling PageMethod.</p><p>So i rewrite it this way </p><pre class="coloredcode"><urlMappings><br/><add url="~/ComputerManager/WorkstationList.aspx" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=1"/><br/><add url="~/ComputerManager/ServerList.aspx" mappedUrl="~/ComputerManager/ComputerList.aspx?comp_type=2"/><br/><add url="~/ComputerManager/WorkstationList.aspx/SetSelection" mappedUrl="~/ComputerManager/ComputerList.aspx/SetSelection"/><br/><add url="~/ComputerManager/ServerList.aspx/SetSelection" mappedUrl="~/ComputerManager/ComputerList.aspx/SetSelection"/><br/></urlMappings></pre><p> and that solves my problem.</p><p>Thanks for good idea,<strong>ziqbalbh.</strong></p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0tag:blogger.com,1999:blog-7088177698862734621.post-79189278643426773672012-03-28T19:54:00.000-04:002012-03-28T19:54:06.489-04:00PageMethod in the codebehind<p>I have a method in my codebehind that I would like to call from javascript. My script manager tag has EnablePageMethods="true" and the method in my codebehind is tagged with [WebMethod] and [ScriptMethod]. When I trigger the javascript, I get errors. I've found some things that say that if you want to call a server side method (not in a web service) from your javascript with the PageMethods collection, you have to have that in a script block in your aspx. I've created a script block with a method in my aspx that just calls the function in my codebehind, but I think that's kind of ugly. Is there something I might have just missed that would allow me to just call my codebehind?</p><p>Thanks </p><p>Here's a code example: http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/<br/> </p><br /><p>Your pagemethod has to be public and static. If that doesn't help, try posting some sample code for us to help debug.</p><br /><p>Thanks. That's what I was trying and it didn't work for me. I found some posts around that said that if you wanted to do this, the server side method you were calling had to be in the ASPX. Seemed to fit because of the errors I was getting and the fact that putting a wrapper function in my ASPX for the actual method I wanted to call worked. However, I gave it one more shot this morning (same exact code that didn't work before, I swear) and it's gold. </p>amenitycvbihttp://www.blogger.com/profile/00163708037708726393noreply@blogger.com0