I have a drop down list box like following. Under some condition, in the databound event I want to remove the items whose bitActive is set to 0 (inactive). I did not put a WHERE bitAcive!=0 in the selectCommand, because I only want to remove them under some conditions. Is there any way I could iterate the items and check the value of bitActive?
<tr>
<td width="30%" align="right">Location<span class="littlefont">*</span></td>
<td width="70%" align="left">
<asp:DropDownList ID="ddlLocation" runat="server"
DataSourceID="SqlDSLocation" DataTextField="txtRefLocation_Name"
DataValueField="intRefLocation_ID" ondatabound="ddlLocation_DataBound">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDSLocation" runat="server"
ConnectionString="<%$ ConnectionStrings:SPRConnectionString %>"
SelectCommand="SELECT DISTINCT [intRefLocation_ID], [txtRefLocation_Name], [location], [bitActive] FROM [tblRefLocation] ORDER BY [intRefLocation_ID]">
</asp:SqlDataSource>
</td>
</tr>