<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" 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>Never use a MultiView inside a Repeater</title>
    <link>http://blogs.lotterypost.com/speednet/2007/8/never-use-a-multiview-inside-a-repeater.htm</link>
    <atom:link href="http://www.lotterypost.com/rss/blogcomments/18302" rel="self" type="application/rss+xml" />
    <description>Speednet's Blog: Never use a MultiView inside a Repeater</description>
    <dc:language>en-us</dc:language>
    <generator>Lottery Post RSS Generator</generator>
    <item>
      <title>Original Blog Entry: Never use a MultiView inside a Repeater</title>
      <link>http://blogs.lotterypost.com/speednet/2007/8/never-use-a-multiview-inside-a-repeater.htm</link>
      <guid isPermaLink="true">http://blogs.lotterypost.com/speednet/2007/8/never-use-a-multiview-inside-a-repeater.htm</guid>
      <pubDate>Wed, 01 Aug 2007 04:40:43 GMT</pubDate>
      <dc:creator>Speednet</dc:creator>
      <description><![CDATA[<p><strong><em>...Unless you want a ViewState larger than the rest of your page</em></strong></p><p>First off, without the help of Fritz Onion's <a href="http://www.pluralsight.com/tools.aspx" rel="external">ViewStateDecoder</a>, my life would have been messed up a lot longer than it was tonight, as I was searching for a reason to explain a 60K ViewState embedded in&nbsp;a page.</p><p>I&nbsp;meticulously turned off the ViewState in every server control that did not need it with no apparent effect on the ViewState size.</p><p>Googling, I came upon Frtiz's ViewState tool, which allows you to see the contents of the ViewState.&nbsp; The utility actually has quite a few nice features, such as the ability to pull ViewState out of any published page -- directly.</p><p>What the tool showed me was that a lot of what I was seeing in the page was actually the ControlState, not the ViewState.&nbsp; Of course, it all looks the same when you see it in the page, but there is an big difference between the two.</p><p>ControlState is something you can't turn off.&nbsp; It is a control's fail-safe way of being able to save state information, just in case ViewState is disabled in the page.</p><p>So I traced almost the entire bulk of ViewState in the page to 3 MultiView controls that were sitting inside templates&nbsp; of a Repeater control.&nbsp; I could disable ViewState for the entire page, and it still couldn't touch that ControlState.</p><p>Who designs these things?</p><p>Anyway, I came up with a solution that allows me to keep the MultiViews, and even leave them inside the repeater.</p><p>I built a very simple <strong>MultiViewLite</strong> control, which is inherited from the MultiView, and disables the ControlView.&nbsp; When I was finished, I just replaced <span style="font-family: courier new,courier">&lt;asp:Multiview...</span> with <span style="font-family: courier new,courier">&lt;MyControls:MultiviewLite...</span> and everything worked perfectly!</p><p>The complete code code listing for the MultiViewLite control can be found below.&nbsp; It has the identical functionality of the standard MultiView control, with the exception that both ControlState and ViewState are disabled.</p><p><strong>MutliViewLite.vb</strong></p><span style="font-size: 12px; color: #0000ff"><span style="font-family: courier new,courier">Public</span></span><span style="font-family: courier new,courier"><span style="font-size: 12px"></span><span style="font-size: 12px; color: #0000ff">Class....</span></span><p>[ <a href="http://blogs.lotterypost.com/speednet/2007/8/never-use-a-multiview-inside-a-repeater.htm">More</a> ]</p>]]></description>
      <category>* Original Blog Entry</category>
      <wfw:comment>http://www.lotterypost.com/blogentry/18302</wfw:comment>
    </item>
  </channel>
</rss>
