<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ASP.Net DropDownList annoyance</title>
	<atom:link href="http://devsushi.com/2007/10/19/aspnet-dropdownlist-annoyance/feed/" rel="self" type="application/rss+xml" />
	<link>http://devsushi.com/2007/10/19/aspnet-dropdownlist-annoyance/</link>
	<description>Discussion on Development in Several Different Flavours</description>
	<lastBuildDate>Fri, 06 Jan 2012 16:25:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: myke black</title>
		<link>http://devsushi.com/2007/10/19/aspnet-dropdownlist-annoyance/comment-page-1/#comment-1230</link>
		<dc:creator>myke black</dc:creator>
		<pubDate>Fri, 10 Jun 2011 08:55:16 +0000</pubDate>
		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/10/19/aspnet-dropdownlist-annoyance/#comment-1230</guid>
		<description>One other possible solution is to use the page_LoadComplete event to update the drop down list rather than doing it in the page_load. load_complete executes after the click_submit event, like this:


  Sub Page_Load()
    If Not Page.IsPostBack Then
      Session(&quot;bool&quot;) = &quot;Open&quot;
    End If

    End Sub

sub page_loadcomplete()
&#039; Setup drop down
    ddlItems.Items.Clear()
    ddlItems.Items.Add(&quot;&quot;)
    If Not Session(&quot;bool&quot;) = &quot;Open&quot; Then ddlItems.Items.Add(&quot;Open&quot;)
    If Not Session(&quot;bool&quot;) = &quot;Closed&quot; Then ddlItems.Items.Add(&quot;Closed&quot;)
  
end sub

  Sub Click_Submit(ByVal s As Object, ByVal e As EventArgs)
    If ddlItems.SelectedValue = &quot;Open&quot; Then
      Session(&quot;bool&quot;) = &quot;Closed&quot;
    ElseIf ddlItems.SelectedValue = &quot;Open&quot; Then
      Session(&quot;bool&quot;) = &quot;Closed&quot;
    End If
  End Sub
</description>
		<content:encoded><![CDATA[<p>One other possible solution is to use the page_LoadComplete event to update the drop down list rather than doing it in the page_load. load_complete executes after the click_submit event, like this:</p>
<p>  Sub Page_Load()<br />
    If Not Page.IsPostBack Then<br />
      Session(&#8220;bool&#8221;) = &#8220;Open&#8221;<br />
    End If</p>
<p>    End Sub</p>
<p>sub page_loadcomplete()<br />
&#8216; Setup drop down<br />
    ddlItems.Items.Clear()<br />
    ddlItems.Items.Add(&#8220;&#8221;)<br />
    If Not Session(&#8220;bool&#8221;) = &#8220;Open&#8221; Then ddlItems.Items.Add(&#8220;Open&#8221;)<br />
    If Not Session(&#8220;bool&#8221;) = &#8220;Closed&#8221; Then ddlItems.Items.Add(&#8220;Closed&#8221;)</p>
<p>end sub</p>
<p>  Sub Click_Submit(ByVal s As Object, ByVal e As EventArgs)<br />
    If ddlItems.SelectedValue = &#8220;Open&#8221; Then<br />
      Session(&#8220;bool&#8221;) = &#8220;Closed&#8221;<br />
    ElseIf ddlItems.SelectedValue = &#8220;Open&#8221; Then<br />
      Session(&#8220;bool&#8221;) = &#8220;Closed&#8221;<br />
    End If<br />
  End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ybbest</title>
		<link>http://devsushi.com/2007/10/19/aspnet-dropdownlist-annoyance/comment-page-1/#comment-372</link>
		<dc:creator>Ybbest</dc:creator>
		<pubDate>Sat, 23 Jan 2010 04:37:11 +0000</pubDate>
		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/10/19/aspnet-dropdownlist-annoyance/#comment-372</guid>
		<description>Why you want setup the dropdownlist when  it is a postback, why can&#039;t you initialize your dropdown list in the Page_Init event when !IsPostback and set the the dropdownlist  to the right value during pastback?</description>
		<content:encoded><![CDATA[<p>Why you want setup the dropdownlist when  it is a postback, why can&#8217;t you initialize your dropdown list in the Page_Init event when !IsPostback and set the the dropdownlist  to the right value during pastback?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

