c# - Add value to Drop Down list when exception occurs -
c# - Add value to Drop Down list when exception occurs -
i have asp .net(4.0) web app. web app has form view contains drop downwards list. drop downwards list populated so:
<asp:dropdownlist id="ddlstaff" runat="server" datasourceid="staffdatasource" datatextfield="staffname" datavaluefield="staffname" appenddatabounditems="true" selectedvalue='<%# bind("staff") %>' > <asp:listitem value=""></asp:listitem> </asp:dropdownlist> <asp:sqldatasource id="staffdatasource" runat="server" connectionstring="<%$ connectionstrings:connectionstring %>" selectcommand="*****"> </asp:sqldatasource>
the staff list changing issue selectedvalue throws error because staff fellow member not exist anymore.
i know can check if item exists in list , grab exception. know if there way display "non-existing" staff fellow member in drop downwards list if not exists? although name not listed staff name stored record. reason want because users need see assigned record if not there anymore.
edit: more details
this how users work.
missing staff name (this selected if not listed , should show record) null adam abigail brandon .....if it's possible can allow them know , i'll have select null when exception thrown.
if fellow member not on list isn't present. why want behaviour? user need old members?
you create list members old , new ones - have code list not declaring. cannot source controls. can provide collection utilize datasource.
hope helped bit.
c# asp.net
Comments
Post a Comment