0

我正在使用母版页、更新面板、AJAX 选项卡容器以及 modalpopup 扩展器和其他 AJAX 验证控件。Termination Reaon 的粗体线有问题。我需要<asp:ListItem Text="Select Contract Termination Reason.." Value=""></asp:ListItem>控制错误:

'ddlContractTerminationReason' 有一个无效的 SelectedValue,因为它不存在于项目列表中”

它可以工作,但是在尝试对应用程序进行一些其他更改时突然开始被删除。如果我一点击保存就尝试再次输入,它会被删除并保存文件。我的网络管理员为我重新安装了所有东西,假设是某些病毒问题,但看起来是其他原因造成的。非常感谢您对此的任何帮助。

<tr> 
  <td> 
    <asp:DropDownList ID="ddlContractTerminationReason" runat="server" AppendDataBoundItems="True" CausesValidation="True" CssClass="dropdown extralong" DataSourceID="dsTerminationReason" DataTextField="ReasonDescription" DataValueField="TerminationReasonID">
      <asp:ListItem Text="Select Contract Termination Reason.."></asp:ListItem>            
    </asp:DropDownList> 
    <asp:CustomValidator ID="cusValTerminationReason" runat="server" ClientValidationFunction="RequireTerminationReason" ControlToValidate="ddlContractTerminationReason" ErrorMessage="Please enter Termination Reason OR Other Resson, if the Contractor is Terminated!" OnServerValidate="ServerValidateTerminationDate" SetFocusOnError="True" Text="*" ValidateEmptyText="True" ValidationGroup="ContrMasterGroup"></asp:CustomValidator> 
    <asp:SqlDataSource ID="dsTerminationReason" runat="server" ConnectionString="<%$ ConnectionStrings:Conn %>" SelectCommand="SELECT [TerminationReasonID], [ReasonDescription] FROM [TerminationReasons] ORDER BY [ReasonDescription]"> </asp:SqlDataSource>
  </td>
  <td class="rightalign">
    <asp:Label ID="lblOtherContractTerminationReason" runat="server" CssClass="lbl" Text="if Others, Explain:"></asp:Label>
  </td>
  <td>
   <asp:TextBox ID="txtOtherContractTerminationReason" runat="server" CssClass="long" TextMode="MultiLine"></asp:TextBox> 
  </td>
  <td> </td>
</tr>
4

1 回答 1

0

在您的 DataBind 执行此代码之后

ddlContractTerminationReason.DataBind();
ddlContractTerminationReason.Items.Add("Select Contract Termination Reason..");
于 2012-08-28T17:14:10.923 回答