﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WebForms (How do I?)  » Dropdown list - null value</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 25 Apr 2026 21:26:05 GMT</lastBuildDate><ttl>20</ttl><item><title>Dropdown list - null value</title><link>http://forum.strataframe.net/FindPost9131.aspx</link><description>Hello,&lt;/P&gt;&lt;P&gt;Newbie question - I'm using a dropdownlist on a web form.&amp;nbsp; The dropdown is populated from a view which contains possible values for the field with the exception of a null value (empty string).&lt;/P&gt;&lt;P&gt;The database allows nulls in these fields, and the field is set up within the Business Object Mapper to "Use nullable generic".&amp;nbsp; &lt;/P&gt;&lt;P&gt;All fields that have a non-null value are binding and displaying correctly when the page loads.&amp;nbsp; However, when the value is null, I'd like the user to see that there is no value for the field by seeing a blank dropdown when the page first loads for editing.&amp;nbsp; So far, though, I haven't been able to do this.&amp;nbsp; What I see when the page first loads is the first value of the dropdown list as defined by the view that populates the list of potential values.&lt;/P&gt;&lt;P&gt;I'm sure I'm just missing something simple -- any ideas?&lt;/P&gt;&lt;P&gt;Mark</description><pubDate>Tue, 29 May 2007 08:41:38 GMT</pubDate><dc:creator>Mark Dowlearn</dc:creator></item><item><title>RE: Dropdown list - null value</title><link>http://forum.strataframe.net/FindPost9137.aspx</link><description>You should be able to use the Return Alternate on Null / Set Null on Alternate and return and use this as your replacement value:&lt;/P&gt;&lt;P&gt;new Guid("00000000-0000-0000-0000-000000000000")&lt;/P&gt;&lt;P&gt;Then, in the TopMostValue of the combo box, put the value as 00000000-0000-0000-0000-000000000000.&amp;nbsp; There is a GuidTypeConverter that should convert he string representation of the value into the proper Guid value.&lt;/P&gt;&lt;P&gt;Hope that helps.</description><pubDate>Tue, 29 May 2007 08:41:38 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Dropdown list - null value</title><link>http://forum.strataframe.net/FindPost9136.aspx</link><description>[quote][b]Trent L. Taylor (05/29/2007)[/b][hr]Mark,&lt;P&gt;In this case I would use a "Return alternate value on NULL" and return an empty string.&amp;nbsp; At preset you indicated you are using a Nullable Generic...this is another type class.&amp;nbsp; So it does not return a String type, but rather a Nullable type.&amp;nbsp; If you change this to Return Alternate value on Null and then return an empty string: "" or String.Empty then you should have a much easier time moving forward.[/quote]&lt;P&gt;Trent -&lt;P&gt;Thanks for your quick response.&lt;P&gt;The reason I was using a nullable generic is because the value associated with my dropdown field is a GUID.&amp;nbsp; If I change to "Return Alternate value on Null" or either of the "Return Alternate on Null / Set Null on Alternate" variations, they generate a build error "Cannot implicitly convert type 'string' to GUID" at the following section of code:&lt;/P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT size=2&gt;&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; uAffiliationID&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;/summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Browsable&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;false&lt;/FONT&gt;&lt;FONT size=2&gt;),&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;BusinessFieldDisplayInEditor&lt;/FONT&gt;&lt;FONT size=2&gt;(),&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Description&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"uAffiliationID"&lt;/FONT&gt;&lt;FONT size=2&gt;),&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DesignerSerializationVisibility&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DesignerSerializationVisibility&lt;/FONT&gt;&lt;FONT size=2&gt;.Hidden)]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; System.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt; uAffiliationID&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp; get&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object&lt;/FONT&gt;&lt;FONT size=2&gt; loValue;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; loValue = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentRow[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"uAffiliationID"&lt;/FONT&gt;&lt;FONT size=2&gt;];&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size=2&gt; (loValue == &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DBNull&lt;/FONT&gt;&lt;FONT size=2&gt;.Value)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;.Empty;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp; else &lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/FONT&gt;&lt;FONT size=2&gt; (System.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;)loValue;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp; set&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;FONT size=2&gt; != &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;.Empty)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;this&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentRow[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"uAffiliationID"&lt;/FONT&gt;&lt;FONT size=2&gt;] = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; this&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentRow[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"uAffiliationID"&lt;/FONT&gt;&lt;FONT size=2&gt;] = &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DBNull&lt;/FONT&gt;&lt;FONT size=2&gt;.Value;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P dir=ltr&gt;&lt;FONT size=2&gt;Given this, I'm still not sure what the correct way to implement the dropdown is.&lt;/FONT&gt;&lt;/P&gt;&lt;P dir=ltr&gt;&lt;FONT size=2&gt;Yours,&lt;/FONT&gt;&lt;/P&gt;&lt;P dir=ltr&gt;&lt;FONT size=2&gt;Mark&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Tue, 29 May 2007 08:37:52 GMT</pubDate><dc:creator>Mark Dowlearn</dc:creator></item><item><title>RE: Dropdown list - null value</title><link>http://forum.strataframe.net/FindPost9132.aspx</link><description>Mark,&lt;/P&gt;&lt;P&gt;In this case I would use a "Return alternate value on NULL" and return an empty string.&amp;nbsp; At preset you indicated you are using a Nullable Generic...this is another type class.&amp;nbsp; So it does not return a String type, but rather a Nullable type.&amp;nbsp; If you change this to Return Alternate value on Null and then return an empty string: "" or String.Empty then you should have a much easier time moving forward.</description><pubDate>Tue, 29 May 2007 07:53:36 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>