<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Client Side Web Development</title><link>http://forums.asp.net/130.aspx</link><description>Client-side programming discussions, including CSS, DHTML, JScript/Javascript, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=18&amp;c=16" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/3354511.aspx</link><pubDate>Tue, 18 Aug 2009 16:35:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3354511</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3354511.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=3354511</wfw:commentRss><description>&lt;p&gt;What does &amp;quot;owned&amp;quot; mean? And why should I care anyways?&lt;/p&gt;
&lt;p&gt;NC...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/3354395.aspx</link><pubDate>Tue, 18 Aug 2009 15:45:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3354395</guid><dc:creator>Fras77</dc:creator><author>Fras77</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3354395.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=3354395</wfw:commentRss><description>&lt;p&gt;NC01, people are still reading this thread and finding it useful even now, and you&amp;#39;re getting owned every time someone reads it.&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/2982614.aspx</link><pubDate>Wed, 04 Mar 2009 17:20:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2982614</guid><dc:creator>CptCoathanger</dc:creator><author>CptCoathanger</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2982614.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2982614</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Nice one, dude.&amp;nbsp; Should have thought of it myself really!&amp;nbsp; Don&amp;#39;t pay any attention to the miserable chap bemoaning you resurrecting a thread, he must have a little sand in his vagina. &lt;img src="http://forums.asp.net/emoticons/emotion-5.gif" alt="Wink" /&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/2895766.aspx</link><pubDate>Tue, 27 Jan 2009 18:24:34 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2895766</guid><dc:creator>d4446</dc:creator><author>d4446</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2895766.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2895766</wfw:commentRss><description>&lt;p&gt;It helped me and I believe you contributed more than all previous posts.&amp;nbsp; &lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/2700404.aspx</link><pubDate>Wed, 22 Oct 2008 19:22:34 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2700404</guid><dc:creator>RobSil</dc:creator><author>RobSil</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2700404.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2700404</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;NC01:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/p&gt;&lt;p&gt;Because the post has been resolved and&lt;span style="font-weight:bold;"&gt; you really did not contribute much if anything different &lt;/span&gt;than what was already posted.&lt;/p&gt;
&lt;p&gt;NC...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;No contribution? &amp;nbsp; I shortened your original post into not requiring ANY server-side coding, you don&amp;#39;t consider that a contribution?&amp;nbsp; This means no custom variables (a string at that?) and no need to get/set them in the Page_Load EVERY time you implement this approach.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Since you seem willing to debate minute details about an implementation... why would you ever track the exact same variable twice in your code-behind if you don&amp;#39;t need to?&amp;nbsp; Not only that, your tracking it as a string rather than a bool, which is much more in-efficient.&amp;nbsp; Finally, your assuming that it will be set in every Page_Load which means the user would need to repeat unnecessary code in his Page_Load&amp;#39;s.&amp;nbsp; Also worth pointing out that in the first response you made in this thread, you used a hidden element when it is not needed.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Back to your previous post, this thread will be read for some time I am sure (clearly if I found it year(s) after it was originally discussed), so why not attempt to provide the best/easiest solution possible?&amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/2700387.aspx</link><pubDate>Wed, 22 Oct 2008 19:08:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2700387</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2700387.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2700387</wfw:commentRss><description>&lt;p&gt;Because the post has been resolved and you really did not contribute much if anything different than what was already posted.&lt;/p&gt;
&lt;p&gt;NC...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/2700377.aspx</link><pubDate>Wed, 22 Oct 2008 19:05:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2700377</guid><dc:creator>RobSil</dc:creator><author>RobSil</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2700377.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2700377</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;NC01:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/p&gt;&lt;p&gt;Why reply on a post that is over a year old?&lt;/p&gt;

&lt;p&gt;NC... &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;Why not?&amp;nbsp; I came across the post researching a problem, so others might as well. &amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/2700371.aspx</link><pubDate>Wed, 22 Oct 2008 19:03:34 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2700371</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2700371.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2700371</wfw:commentRss><description>&lt;p&gt;Why reply on a post that is over a year old?&lt;/p&gt;
&lt;p&gt;NC...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/2700316.aspx</link><pubDate>Wed, 22 Oct 2008 18:36:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2700316</guid><dc:creator>RobSil</dc:creator><author>RobSil</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2700316.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2700316</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;To extend all this a little bit further...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function bodyOnLoad() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&amp;quot;Is Postback: &amp;lt;%Response.Write(Page.IsPostBack);%&amp;gt;&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &amp;lt;/script&amp;gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;body onload=&amp;quot;bodyOnLoad()&amp;quot;&amp;gt;... &amp;lt;/body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Just use the postback variable already in the page.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;HTH,&lt;/p&gt;&lt;p&gt;Robin&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/1893974.aspx</link><pubDate>Wed, 05 Sep 2007 14:51:40 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1893974</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1893974.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=1893974</wfw:commentRss><description>&lt;p&gt;Never heard of a &amp;#39;Restricted_COER_Attachments&amp;#39;. Maybe it is coming from something that your 3rd party app is inserting?&lt;/p&gt;
&lt;p&gt;The idea that jsearles presented should also work however:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In the aspx file:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;function isPostBack()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;var serverSidePostBack = &amp;#39;&amp;lt;%= clientSideIsPostBack %&amp;gt;&amp;#39;;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;return (serverSidePostBack == &amp;#39;Y&amp;#39;) ? true : false;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In the aspx.cs file:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;// Declare outside of any method:&lt;br /&gt;public string clientSideIsPostBack = &amp;quot;N&amp;quot;;&lt;/p&gt;
&lt;p&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;if ( this.IsPostBack )&lt;br /&gt;&amp;nbsp;&amp;nbsp;this.clientSideIsPostBack = &amp;quot;Y&amp;quot;;&lt;br /&gt;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;this.clientSideIsPostBack = &amp;quot;N&amp;quot;;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;NC...&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/1893518.aspx</link><pubDate>Wed, 05 Sep 2007 11:11:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1893518</guid><dc:creator>jsearles</dc:creator><author>jsearles</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1893518.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=1893518</wfw:commentRss><description>What i have always done to deal with this is declare a global variable in javascript and then set it after the initial page load. 

For example:

var isPostBack = false;

function pageLoad() {
     if (!isPostBack) {
         // Do stuff
         
         isPostBack = true;
     }
}

It&amp;#39;s always worked for me.</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/1892555.aspx</link><pubDate>Tue, 04 Sep 2007 22:08:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1892555</guid><dc:creator>jon_angel</dc:creator><author>jon_angel</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1892555.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=1892555</wfw:commentRss><description>&lt;p&gt;Many thanks, I&amp;#39;m almost there, but I&amp;#39;m getting a weird error &amp;#39;Restricted_COER_Attachments&amp;#39; does not contain a definition for &amp;#39;clientSideIsPostBack&amp;#39;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Intellisense sure finds a definition, but Compilation doesn&amp;#39;t.&amp;nbsp; If I add an explicit definition in the aspx.cs, Intellisense tells me the HtmlHiddenInput object is defined twice.&amp;nbsp; Dragging an Input (Hidden) from the HTML section of the toolbox makes no difference.&lt;/p&gt;
&lt;p&gt;However if I Build Page it works fine (?!)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/1887324.aspx</link><pubDate>Fri, 31 Aug 2007 16:51:03 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1887324</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1887324.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=1887324</wfw:commentRss><description>&lt;p&gt;It&amp;#39;s easy enough to detect whether a PostBack has occurred client-side:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In the aspx file:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;form id=&amp;quot;Form1&amp;quot; method=&amp;quot;post&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;p&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;asp:button id=&amp;quot;postBackButton&amp;quot; runat=&amp;quot;server&amp;quot; text=&amp;quot;PostBack&amp;quot;&amp;gt;&amp;lt;/asp:button&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;p&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Check for PostBack&amp;quot; onclick=&amp;quot;JavaScript: alert(&amp;#39;IsPostBack: &amp;#39; + isPostBack());&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/p&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;clientSideIsPostBack&amp;quot; name=&amp;quot;clientSideIsPostBack&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;function isPostBack()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;if ( !document.getElementById(&amp;#39;clientSideIsPostBack&amp;#39;) )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;if ( document.getElementById(&amp;#39;clientSideIsPostBack&amp;#39;).value == &amp;#39;Y&amp;#39; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In the aspx.cs file:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;if ( this.IsPostBack )&lt;br /&gt;&amp;nbsp;&amp;nbsp;this.clientSideIsPostBack.Value = &amp;quot;Y&amp;quot;;&lt;br /&gt;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;this.clientSideIsPostBack.Value = &amp;quot;N&amp;quot;;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;NC...&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/1887243.aspx</link><pubDate>Fri, 31 Aug 2007 16:07:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1887243</guid><dc:creator>jon_angel</dc:creator><author>jon_angel</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1887243.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=1887243</wfw:commentRss><description>&lt;p&gt;Cookies probably aren&amp;#39;t an option, according to policy.&amp;nbsp; What would work is detecting that the RequiredFieldValidator has fired and is displaying its error message.&amp;nbsp; But in debug mode I couldn&amp;#39;t find a property of the validator nor the RadioButtonList that it validates that tells me this.&lt;/p&gt;</description></item><item><title>Re: Javascript:  detect Page.IsValid and IsPostBack</title><link>http://forums.asp.net/thread/1887197.aspx</link><pubDate>Fri, 31 Aug 2007 15:45:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1887197</guid><dc:creator>mattmeckes</dc:creator><author>mattmeckes</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1887197.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=1887197</wfw:commentRss><description>&lt;p&gt;If you are doing this client side I dont think you can check if it is posted back. You could create a cookie when the page is first loaded. You can store the value of the global client side variable Page_IsValid in the cookie. If the page is posted back the cookie will already exist and you can check if the original was valid.&lt;/p&gt;</description></item></channel></rss>