Filtering NULL Values by URL http://forums.asp.net/t/1708273.aspx/1?Filtering+NULL+Values+by+URL+Mon, 08 Aug 2011 08:38:38 -040017082734543840http://forums.asp.net/p/1708273/4543840.aspx/1?Filtering+NULL+Values+by+URL+Filtering NULL Values by URL <p>Hello,</p> <p>I have a DD project including some custom pages like an entry page displaying different &quot;statistics&quot;. One of this informations shows the number of users who are not assigned to a specific project. Due to my model, this are all users who have not set a Project ID (Foreign Key to Project Table).&nbsp;</p> <p>I want to build a hyperlink that forwards to the List.aspx Page of the Users, only showing all not assigned Users. The link to show all Users assigned to a specific Project would be:</p> <p>http://somewebsite/Users/List.aspx?Project.ID=123</p> <p>But how to filter on Users who are not yet assigned to a project, like:</p> <p>http://somewebsite/Users/List.aspx?Project.ID=[null]</p> &lt;div&gt;&lt;/div&gt; &lt;div&gt;Regards,&lt;/div&gt; &lt;div&gt;Christoph&nbsp;&lt;/div&gt; 2011-08-08T08:08:22-04:004543869http://forums.asp.net/p/1708273/4543869.aspx/1?Re+Filtering+NULL+Values+by+URL+Re: Filtering NULL Values by URL <p>Do not pass anything to the list page then it would be requesting for all users. If you pass the project id then show the users for the project.</p> <pre class="prettyprint">If(Request.QueryString[&quot;ProductID&quot;] == null) { //List all users. } else { //Logic to display users specific to the project. }</pre> 2011-08-08T08:24:44-04:004543908http://forums.asp.net/p/1708273/4543908.aspx/1?Re+Filtering+NULL+Values+by+URL+Re: Filtering NULL Values by URL <p>What ever you decide to do you must set the filter to the [Not Set] value in the DDL</p> <pre class="prettyprint">// Set the initial value if there is one string initialValue = DefaultValue; if (!String.IsNullOrEmpty(initialValue)) DropDownList1.SelectedValue = initialValue;</pre> <p>This code is where the value is set&nbsp; you will need to test for your special value forst then set the selected value to NullValueString.</p> 2011-08-08T08:38:38-04:00