我对开发表达非常新。
<dx:ASPxGridView ID="aspxgvOMContracts" runat="server" KeyFieldName="OMContractId" Settings-UseFixedTableLayout="true"
AutoGenerateColumns="False" Settings-HorizontalScrollBarMode="Auto" Width="477px" Theme="PlasticBlue"
OnRowUpdating="aspxgvOMContracts_OnRowUpdating" OnRowUpdated="aspxgvOMContracts_OnRowUpdated">
<SettingsPager PageSize="5" />
<SettingsBehavior AllowFocusedRow="true" />
<SettingsEditing Mode="Inline" />
<%-- <Styles>
<CommandColumnItem Spacing="">
<Paddings PaddingLeft="7" PaddingRight="7" />
</CommandColumnItem>
</Styles>--%>
<Columns>
<dx:GridViewCommandColumn ButtonType="Image" Width="65px" VisibleIndex="0">
<EditButton Visible="True" Image-Url="../Content/Images/icon_edit.png">
</EditButton>
<UpdateButton Visible="True" Image-Url="../Content/Images/icon_update.png">
</UpdateButton>
<CancelButton Visible="true" Image-Url="../Content/Images/icon_cancel.png">
</CancelButton>
<DeleteButton Visible="true" Image-Url="../Content/Images/icon_delete.png">
</DeleteButton>
<ClearFilterButton Visible="True">
</ClearFilterButton>
<%-- <HeaderTemplate>
<dx:ASPxLabel ID="headerLabel" runat="server">
</dx:ASPxLabel>
</HeaderTemplate>--%>
</dx:GridViewCommandColumn>
<dx:GridViewDataComboBoxColumn FieldName="OrganisationName" Caption="OrganisationName" VisibleIndex="1">
<PropertiesComboBox TextField="CompanyName" ValueField="OrganisationId" ValueType="System.Int32">
</PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
<dx:GridViewDataTimeEditColumn FieldName="DateAnnounced" Caption="DateAnnounced" VisibleIndex="2">
</dx:GridViewDataTimeEditColumn>
<dx:GridViewDataTextColumn FieldName="Cost" Caption="Cost" VisibleIndex="3">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="CostCurrency" Caption="Cost Currency" VisibleIndex="4">
</dx:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
在代码后面我将数据绑定为
aspxgvOMContracts.DataSource = phase.OMContracts;
aspxgvOMContracts.DataBind();
此处phase.OMContracts的类型为List()
现在,当我编辑任何行时,我需要修改后的集合。如何获得修改后的集合?
答案 0 :(得分:0)
您已经分配了AspxGridview控件的DataSource属性,然后您可以直接从DataSource属性访问分配的已分配List
,它是一个读写属性。
查看文档:
ASPxDataWebControlBase.DataSource Property
获取或设置数据绑定控件从中检索的对象 它的数据项列表。
来自:Get GridView data source to Data table
如果你在每次回发时绑定gridview,那么你可以获得DataTable dt = GridView1.DataSource作为DataTable;
与List<SomeType> data = grid.DataSource as List<SomeType>;
希望这有帮助..