我最近做的项目是用ext.net做的,在做的时候遇到一个问题就是在绑定DateField的时候,从后台取出的日期值在前台绑定不上,求高手指点。我的代码如下:
前台
<ext:GridPanel runat="server" ID="GPOperationRights" Title="所属权限" ButtonAlign="Center"
Resizable="false" Margins="0 0 0 0" AutoScroll="true">
<Store>
<ext:Store runat="server" ID="Data" OnReadData="storeResult_Refresh" PageSize="9">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="End_Date">
</ext:ModelField>
<ext:ModelField Name="OperationID">
</ext:ModelField>
<ext:ModelField Name="OperationName">
</ext:ModelField>
<ext:ModelField Name="Right_Type">
</ext:ModelField>
<ext:ModelField Name="Start_Date">
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" ID="OperName" DataIndex="OperationName" Align="Center"
Width="150">
</ext:Column>
<ext:ComponentColumn runat="server" ID="Operation" DataIndex="Right_Type" Align="Center"
Width="100" Editor="true">
<Component>
<ext:SelectBox ID="sbCodeRel" runat="server">
<Items>
<ext:ListItem Value="0" Text="操作" Mode="Raw">
</ext:ListItem>
<ext:ListItem Value="2" Text="授权" Mode="Raw">
</ext:ListItem>
<ext:ListItem Value="9" Text="全部权限" Mode="Raw">
</ext:ListItem>
</Items>
<SelectedItems>
<ext:ListItem Value="{Right_Type}" />
</SelectedItems>
</ext:SelectBox>
</Component>
</ext:ComponentColumn>
<ext:ComponentColumn runat="server" ID="StartDate" DataIndex="Start_Date" Text="开始时间"
Align="Center" Width="140" Editor="true">
<Component>
<ext:DateField ID="dfdStartDate" runat="server" LabelAlign="Right" Vtype="daterange"
Format="yyyy-MM-dd" AutoRender="true" Editable="true">
<CustomConfig>
<ext:ConfigItem Name="StartDate" Value="{Start_Date}" Mode="Value" />
</CustomConfig>
</ext:DateField>
</Component>
</ext:ComponentColumn>
<ext:ComponentColumn runat="server" ID="EndDate" DataIndex="End_Date" Text="结束时间"
Align="Center" Width="140" Editor="true">
<Component>
<ext:DateField ID="dfdEndDate" runat="server" LabelAlign="Right" Format="yyyy-MM-dd H:m:s"
AllowBlank="false">
<CustomConfig>
<ext:ConfigItem Name="EndDate" Value="{End_Date}" Mode="Value" />
</CustomConfig>
</ext:DateField>
</Component>
</ext:ComponentColumn>
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server">
</ext:PagingToolbar>
</BottomBar>
</ext:GridPanel>
后台:
private void ShowOperationRights(List<string> operationId)
{
List<OperationRights> list = utility.GetOperationRights(operationId, rightclass, id, LanguageID);
GPOperationRights.GetStore().DataSource = list;
GPOperationRights.GetStore().DataBind();
}
这个list返回的数据里面Start_Date 和End_Date都有值,但是就是在前台显示不出来,求高手指点······