<?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>State Management</title><link>http://forums.asp.net/22.aspx</link><description>Managing ASP.NET state - ViewState, Application, Session, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=69&amp;c=17" 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: Problems with IPostBackDataHandler interface?</title><link>http://forums.asp.net/thread/3237891.aspx</link><pubDate>Tue, 16 Jun 2009 19:22:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3237891</guid><dc:creator>rmdw</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3237891.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=22&amp;PostID=3237891</wfw:commentRss><description>&lt;p&gt;After about 5 hours of scratching my head on this, I finally found a solution ... though I don&amp;#39;t know why it works!&lt;/p&gt;&lt;p&gt;I&amp;#39;ve long followed the practice of setting: &lt;i&gt;EnableViewState=&amp;quot;false&amp;quot;&lt;/i&gt; on any page which I didn&amp;#39;t feel needed ViewState.&amp;nbsp; This seemed to be a good practice.&lt;/p&gt;&lt;p&gt;And in the case of IPostBackDataHandler, articles like this one seemed to confirm that it was fine to turn off the View State: http://www.codeproject.com/KB/viewstate/ViewState.aspx&lt;/p&gt;&lt;p&gt;Yet when I noticed that my test Content Page had &lt;i&gt;EnableViewState=&amp;quot;false&amp;quot;&lt;/i&gt;&amp;nbsp; I set it to true and ... voila, suddenly my User Control toolbar had its changed values restored once again!&lt;/p&gt;&lt;p&gt;Then I set EnableViewState back to false in the Content Page and explicitly set it to true in the User Control.&amp;nbsp; It did not work.&lt;/p&gt;&lt;p&gt;So there&amp;#39;s a bit of a mystery here.&amp;nbsp; Certainly I have things working now but I would love to hear from a State Management guru as to why things are occurring as they are!&lt;/p&gt;&lt;p&gt;Robert &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Problems with IPostBackDataHandler interface?</title><link>http://forums.asp.net/thread/3237767.aspx</link><pubDate>Tue, 16 Jun 2009 18:21:21 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3237767</guid><dc:creator>rmdw</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3237767.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=22&amp;PostID=3237767</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m following up on a previous post but targeting in where I now think the problem lies.&amp;nbsp; Here&amp;#39;s my situation:&lt;/p&gt;&lt;p&gt;I have an ASP.Net 3.5 web project written in C#.&amp;nbsp; I am trying to introduce a toolbar which is implemented as follows:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Custom built toolbar, which consists of link buttons.&amp;nbsp; It resides in a User Control.&lt;/li&gt;&lt;li&gt;&amp;nbsp; The User Control is instantiated at the top of a Master Page.&lt;/li&gt;&lt;li&gt;&amp;nbsp; &amp;nbsp; The Master Page is referenced by several Content Pages. &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I&amp;#39;ve constructed things in such a way that I can customize the names &amp;amp; images of each toolbar button.&amp;nbsp; So, for example, one Content Page may display these toolbar buttons:&amp;nbsp; Add Edit Move Save.&amp;nbsp; While another Content Page may display these toolbar buttons:&amp;nbsp; Insert Delete Save.&amp;nbsp; Any combination of the known button types is permissible.&lt;/p&gt;&lt;p&gt;As you&amp;#39;re probably envisioning, the toolbar buttons are instantiated dynamically, depending on what parameters are passed to the &amp;#39;CreateCommandButtons&amp;#39; method within the User Control.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Everything is working fine except for one crucial thing: When I change the enabled/disabled setting of each toolbar button, the value is not remembered after a postback; in my particular case, it&amp;#39;s a partial postback on an AJAX enabled page.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So I went back to basics and decided to simulate the same approach in a small test project, which you can download here: http://mwtech.com/downloads/public/Dynamic_Button_Creator.zip&lt;/p&gt;&lt;p&gt;Here&amp;#39;s what you need to do:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Run the WebForm1.aspx page in this project.&lt;/li&gt;&lt;li&gt;Press the &amp;quot;Press Me to Alter Toolbar Buttons&amp;quot; button a few times. It causes a postback and increments the numeric value of each of the 3 toolbar link buttons.&lt;/li&gt;&lt;li&gt;Now press &amp;quot;Enable Center Button&amp;quot;.&amp;nbsp; Notice how the center toolbar button turns blue, to denote it&amp;#39;s enabled.&lt;/li&gt;&lt;li&gt;Now press the same button as in Step #2 again.&amp;nbsp; Postbacks continue to occur and yet the center button stays blue (ie. enabled).&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;So to my great surprise, the test project works fine!!&amp;nbsp; Yet very similar code within my actual project is not working.&amp;nbsp; Instead, there, when you execute Step #4 above, the center button would revert back to gray.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So I did more reading and it seems that it&amp;#39;s the IPostBackDataHandler interface that is responsible for restoring the altered control values.&amp;nbsp; Yet it&amp;#39;s not doing this in my real project&amp;nbsp; I&amp;#39;m hoping that someone familiar with IPostBackDataHandler can tell me what key things to look for to see why it&amp;#39;s not functioning properly.&lt;/p&gt;&lt;p&gt;Robert &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>