当我双击一个单元格时,我的基础设施WebDataGrid不会进入单元格编辑模式。它不会进入服务器模式 - 没有任何反应。只有客户端事件发生,但我怀疑这些是必要的。以下 asp.net 段有什么问题?
<infra:WebDataGrid ID="wdgProjects" runat="server" EnableAjax="true" AutoGenerateColumns="False"
DataSourceID="sqlProjects" DataKeyFields="ProjectID"
OnInitializeRow="wdgProjects_InitializeRow"
OnCellSelectionChanged="wdgProjects_CellSelectionChanged"
OnActiveCellChanged="wdgProjects_ActiveCellChanged"
>
<Columns>
<infra:TemplateDataField Key="ProjectID" Header-Text="Project ID">
<ItemTemplate>
<asp:Label ID="lblProjectID" runat="server" />
</ItemTemplate>
</infra:TemplateDataField>
<infra:TemplateDataField Key="ProjectName" Header-Text="Project Name">
<ItemTemplate>
<asp:Label ID="lblProjectName" runat="server" />
</ItemTemplate>
</infra:TemplateDataField>
<infra:TemplateDataField Key="ReportingPeriod" Header-Text="Reporting Period">
<ItemTemplate>
<asp:Label ID="lblReportingPeriod" runat="server" />
</ItemTemplate>
</infra:TemplateDataField>
<infra:TemplateDataField Key="ProjectCreator" Header-Text="Project Creator">
<ItemTemplate>
<asp:Label ID="lblProjectCreator" runat="server" />
</ItemTemplate>
</infra:TemplateDataField>
<infra:TemplateDataField Key="ProjectCreation" Header-Text="Project Creation Date">
<ItemTemplate>
<asp:Label ID="lblProjectCreation" runat="server" />
</ItemTemplate>
</infra:TemplateDataField>
</Columns>
<Behaviors>
<infra:Activation Enabled="true" />
<infra:Selection RowSelectType="Single" CellClickAction="Cell" />
<infra:EditingCore AutoCRUD="false" Enabled="true" BatchUpdating="false">
<Behaviors>
<infra:CellEditing Enabled="true" EditModeActions-MouseClick="Double">
<ColumnSettings>
<infra:EditingColumnSetting ColumnKey="ProjectID" ReadOnly="true" />
<infra:EditingColumnSetting EditorID="txtProjectName" ColumnKey="ProjectName" />
<infra:EditingColumnSetting EditorID="ddlReportingPeriod" ColumnKey="ReportingPeriod"/>
<infra:EditingColumnSetting EditorID="txtProjectCreator" ColumnKey="ProjectCreator" />
<infra:EditingColumnSetting EditorID="calProjectCreation" ColumnKey="ProjectCreation" />
</ColumnSettings>
</infra:CellEditing>
<infra:RowAdding Alignment="Bottom" EditModeActions-MouseClick="Double"/>
<infra:RowDeleting Enabled="true" />
</Behaviors>
</infra:EditingCore>
<infra:Sorting>
<ColumnSettings>
<infra:SortingColumnSetting ColumnKey="ProjectID" />
<infra:SortingColumnSetting ColumnKey="ProjectName" />
<infra:SortingColumnSetting ColumnKey="ReportingPeriod" />
<infra:SortingColumnSetting ColumnKey="ProjectCreator" />
<infra:SortingColumnSetting ColumnKey="ProjectCreation" />
</ColumnSettings>
</infra:Sorting>
<infra:Paging PageSize="15" />
</Behaviors>
<EditorProviders>
<infra:TextEditorProvider ID="txtProjectName">
<EditorControl ClientIDMode="Predictable"/>
</infra:TextEditorProvider>
<infra:DropDownProvider ID="ddlReportingPeriod">
<EditorControl DataSourceID="sqlReportingPeriod" TextField="Name" ValueField="Value"
EnableDropDownAsChild="False" DisplayMode="DropDownList" ClientIDMode="Predictable" DropDownContainerMaxHeight="200px"
>
<DropDownItemBinding TextField="Name" ValueField="Value" />
</EditorControl>
</infra:DropDownProvider>
<infra:TextEditorProvider ID="txtProjectCreator">
<EditorControl ClientIDMode="Predictable"/>
</infra:TextEditorProvider>
<infra:WebDateChooserProvider ID="calProjectCreation"/>
</EditorProviders>
<AjaxIndicator Enabled="True" />
</infra:WebDataGrid>
<asp:SqlDataSource runat="server" ID="sqlProjects" ConnectionString="<%$ ConnectionStrings:HelloUranus %>"
SelectCommand="<%$ AppSettings:GetProjects %>" SelectCommandType="StoredProcedure"
InsertCommand="<%$ AppSettings:InsertProject %>" InsertCommandType="StoredProcedure"
UpdateCommand="<%$ AppSettings:UpdateProject %>" UpdateCommandType="StoredProcedure"
DeleteCommand="<%$ AppSettings:DeleteProject %>" DeleteCommandType="StoredProcedure"
OnSelecting="sqlProjects_Selecting"
OnUpdating="sqlProjects_Updating"
>
<SelectParameters>
<asp:Parameter Name="ProjectID" Type="Int32" />
<asp:Parameter Name="ProjectName" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource runat="server" ID="sqlReportingPeriod" ConnectionString="<%$ ConnectionStrings:Floobarf %>"
SelectCommand="<%$ AppSettings:ReportingPeriods %>"
/>
使用 TemplateDataField 时,模板中的控件将始终显示,除非您在模板中实现,否则这些单元格没有编辑模式。 如果您正在寻找可以双击以编辑单元格的默认行为,则应改用 BoundDataField。 如果完成此操作,则网格将使用您在"列设置"中指定的编辑器进行单元格编辑行为。