0

我有一个带有自定义过滤器的 Obout Grid,用于显示有关具有相似但略有不同的字段的两个不同项目的信息。它们共享两列,另外两列根据网格中显示的项目切换可见性。自定义过滤器用于对具有开始日期和结束日期的几列进行排序,另一个使用下拉列表进行排序。首次加载页面时,所有过滤器都正常工作,但是当我单击导致回发切换网格中项目的链接时,过滤器不再正常工作。文本过滤器仍然有效,但下拉列表不再有任何选项,并且“取消日期”选择器不再填充它们旁边显示所选日期的文本框。但是,如果您输入日期,它仍然会正确排序,因此过滤器本身不会损坏。

我已经尝试过使用和不使用 UpdatePanel 的网格,并在上下文切换但行为没有改变时调用更新。

下拉菜单是否会失去其选项或日期选择器会失去与文本框的连接?

自定义日期过滤器:

<obout:GridTemplate ID="templateDateIssuedFilter" runat="server">
  <Template>
    <table>
      <tr>
        <td>
          <asp:Literal ID="litDateIssuedFrom" runat="server" Text="From" />
        </td>
        <td>
          <obout:OboutTextBox ID="txtDateIssuedFrom" runat="server" Width="180px">
            <ClientSideEvents OnKeyUp="applyFilter" />
          </obout:OboutTextBox>
          <obout:Calendar runat="server" DatePickerMode="true" TextBoxId="txtDateIssuedFrom" OnClientDateChanged="applyFilter" DatePickerImagePath="OboutControls/Calendar/styles/date_picker1.gif" />
        </td>
      </tr>
      <tr>
        <td>
          <asp:Literal ID="litDateIssuedTo" runat="server" Text="To" />
        </td>
        <td>
          <obout:OboutTextBox ID="txtDateIssuedTo" runat="server" Width="180px">
            <ClientSideEvents OnKeyUp="applyFilter" />
          </obout:OboutTextBox>
          <obout:Calendar runat="server" DatePickerMode="true" TextBoxId="txtDateIssuedTo" OnClientDateChanged="applyFilter" DatePickerImagePath="OboutControls/Calendar/styles/date_picker1.gif" />
        </td>
      </tr>
    </table>
  </Template>
</obout:GridTemplate>
4

1 回答 1

0

After some playing around, I found that the date pickers just seemed to lose association with their textbox and just need to be reminded. I couldn't find a reason why this happened but it did occur with every postback on the page. I added some code to find the date pickers and reassign the TextBoxId attribute for all of them after every postback.

For the dropdown list, I had to re-add all the options at every postback as well.

于 2014-11-14T14:22:17.823 回答