<?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>Web Forms</title><link>http://forums.asp.net/18.aspx</link><description>All about building ASP.NET Pages - server controls, events, validation, etc.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2596390.aspx</link><pubDate>Wed, 03 Sep 2008 00:34:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2596390</guid><dc:creator>Matt-dot-net</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2596390.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2596390</wfw:commentRss><description>&lt;p&gt;FindControl is not recursive meaning that it will not find controls buried on the page inside a particular parent control at some arbitrary depth.&amp;nbsp; This is a performance consideration.&amp;nbsp; Therefore, FindControl will only find controls within the &amp;quot;naming container&amp;quot; or containing control.&amp;nbsp; So in your example, i can infer that placeholderexpertise is not the naming container control for ASPHELPddlSomeList.&amp;nbsp; You most surely have some other container within placeholderexpertise in which ASPHELPddlSomeList lives.&lt;/p&gt;</description></item><item><title>Re: How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2595747.aspx</link><pubDate>Tue, 02 Sep 2008 17:54:58 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2595747</guid><dc:creator>MSUTech</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2595747.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2595747</wfw:commentRss><description>&lt;p&gt;Thanks..... I have a question:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;THIS WORKS:&lt;/p&gt;&lt;font color="#008000"&gt;
&lt;p&gt;lblexp.Text = Request.Form[&amp;quot;ASPHELPddlSomeList&amp;quot;].ToString();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But, the FindControl does NOT work, any thoughts on WHY?&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000"&gt;DropDownList ddlexpNOW = (DropDownList)placeholderexpertise.FindControl(&amp;quot;ASPHELPddlSomeList&amp;quot;);&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&lt;font color="#008000"&gt;lblexp.Text = ddlexpNOW.SelectedValue;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000"&gt;I still get this error:&lt;/font&gt;&lt;/p&gt;&lt;font color="#008000"&gt;&lt;span&gt;
&lt;h2&gt;&lt;i&gt;Object reference not set to an instance of an object.&lt;/i&gt; &lt;/h2&gt;
&lt;p&gt;&lt;/span&gt;&lt;font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt;&lt;b&gt;Description: &lt;/b&gt;An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Exception Details: &lt;/b&gt;System.NullReferenceException: Object reference not set to an instance of an object.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Source Error:&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;
&lt;table class="" bgcolor="#ffffcc"&gt;

&lt;tr&gt;
&lt;td class=""&gt;&lt;code&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2593919.aspx</link><pubDate>Tue, 02 Sep 2008 03:23:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2593919</guid><dc:creator>Hua-Jun Li - MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2593919.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2593919</wfw:commentRss><description>&lt;p&gt;Hi MSUTech,&lt;/p&gt;
&lt;p&gt;You should check your code.&lt;/p&gt;
&lt;p&gt;(1)You should put the following code inside Page_Load function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DropDownList ddlSomeList = new DropDownList();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddlSomeList.ID = &amp;quot;ddlSomeList&amp;quot;;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /** add each control to the placeholder **/&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; placeholderexpertise.Controls.Add(ddlSomeList);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;(2)You should check your control id is right.&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;DropDownList&lt;/font&gt; ddlexpNOW = (&lt;font color="#2b91af"&gt;DropDownList&lt;/font&gt;)placeholderexpertise.FindControl(&lt;font color="#a31515"&gt;&amp;quot;controIID&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;Or use the following method.&lt;/p&gt;
&lt;p&gt;lblexp.Text =Request.Form[&amp;quot;ddlSomeList&amp;quot;].ToString();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2590528.aspx</link><pubDate>Sat, 30 Aug 2008 14:17:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2590528</guid><dc:creator>Matt-dot-net</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2590528.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2590528</wfw:commentRss><description>&lt;p&gt;That means that FindControl was unable to find your control.&amp;nbsp; Are you really using &amp;quot;ddlSomeList?&amp;quot;&amp;nbsp;&amp;nbsp; Replace this string with the ID you have given your drop down list.&amp;nbsp; I am guessing it is something like &amp;quot;ddlexpNOW.&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2589195.aspx</link><pubDate>Fri, 29 Aug 2008 15:09:19 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2589195</guid><dc:creator>MSUTech</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2589195.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2589195</wfw:commentRss><description>&lt;p&gt;I am using the following code:&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;DropDownList&lt;/font&gt; ddlexpNOW = (&lt;font color="#2b91af"&gt;DropDownList&lt;/font&gt;)placeholderexpertise.FindControl(&lt;font color="#a31515"&gt;&amp;quot;ddlSomeList&amp;quot;&lt;/font&gt;);&lt;/p&gt;
&lt;p&gt;lblexp.Text = ddlexpNOW.SelectedValue;&lt;/p&gt;
&lt;p&gt;which gives me the following error:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Exception Details: &lt;/strong&gt;System.NullReferenceException: Object reference not set to an instance of an object.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Source Error:&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;
&lt;table class="" bgcolor="#ffffcc"&gt;

&lt;tr&gt;
&lt;td class=""&gt;&lt;code&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;</description></item><item><title>Re: How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2589053.aspx</link><pubDate>Fri, 29 Aug 2008 14:23:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2589053</guid><dc:creator>MSUTech</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2589053.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2589053</wfw:commentRss><description>&lt;p&gt;How can I then reference the SelectedValue?&lt;/p&gt;</description></item><item><title>Re: How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2589021.aspx</link><pubDate>Fri, 29 Aug 2008 14:12:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2589021</guid><dc:creator>Matt-dot-net</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2589021.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2589021</wfw:commentRss><description>&lt;p&gt;You can get the dropdownlist by using (DropDownList)placeholderexpertise.FindControl(&amp;quot;ddlSomeList&amp;quot;)&lt;/p&gt;
&lt;p&gt;Or you could make ddlSomeList a private member of your page class and you will have a reference to it in any event/method of your page.&lt;/p&gt;</description></item><item><title>How do I reference a 'selection' made within a placeholder.control.dropdownlist?</title><link>http://forums.asp.net/thread/2588995.aspx</link><pubDate>Fri, 29 Aug 2008 14:02:08 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2588995</guid><dc:creator>MSUTech</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2588995.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2588995</wfw:commentRss><description>&lt;p&gt;Within my aspx.cs file I create the following dropdownlist within a placeholder:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;font color="#008000"&gt;/** create the dropdownlist for this specific time through the loop **/&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;DropDownList&lt;/font&gt; ddlSomeList = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2b91af"&gt;DropDownList&lt;/font&gt;();&lt;/p&gt;
&lt;p&gt;ddlSomeList.ID = &lt;font color="#a31515"&gt;&amp;quot;ddlSomeList&amp;quot;&lt;/font&gt;;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000"&gt;/** add each control to the placeholder **/&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;placeholderexpertise.Controls.Add(ddlSomeList);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then during the following update statement, I want to reference what value the user has selected, I am trying the following, but, it does not work:&lt;/p&gt;
&lt;p&gt;strUpdateQuery1 = &lt;font color="#a31515"&gt;&amp;quot;UPDATE ThePersonUPLOAD SET date_modified=GetDate(),expertise=@expertise WHERE &lt;a href="mailto:person_id=@person_id"&gt;person_id=@person_id&lt;/a&gt;&amp;quot;&lt;/font&gt;;&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af"&gt;SqlCommand&lt;/font&gt; UpdateReviewerCommand = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2b91af"&gt;SqlCommand&lt;/font&gt;(strUpdateQuery1, CurrentConnection);&lt;/p&gt;
&lt;p&gt;UpdateReviewerCommand.Parameters.AddWithValue(&lt;font color="#a31515"&gt;&amp;quot;@expertise&amp;quot;&lt;/font&gt;, placeholderexpertise.ddlSomeList.SelectedValue);&lt;/p&gt;</description></item></channel></rss>