<dx:GridViewDataComboBoxColumn FieldName="Category1ID" VisibleIndex="4">
<PropertiesComboBox DataSourceID="dsCategory1" TextField="Name" ValueField="ID" ValueType="System.Int32">
</PropertiesComboBox>
<EditItemTemplate>
<dxe:ASPxComboBox ID="Cat1" runat="server"
DataSourceID="dsCategory1" TextField="Name" ValueField="ID" Value='<%# Bind("Category1ID") %>'
AutoPostBack="true" OnSelectedIndexChanged="Cat1_SelectedIndexChanged" ValueType="System.Int32">
</dxe:ASPxComboBox>
</EditItemTemplate>
</dx:GridViewDataComboBoxColumn>
------------------------------------------------------------------------------------------------------------
protected void grid_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
{
if ((e.RowType == GridViewRowType.InlineEdit)) {
ASPxComboBox combo2 = ((ASPxComboBox)grid.FindEditRowCellTemplateControl(
grid.Columns["Category2ID"] as GridViewDataComboBoxColumn, "Cat2"));
if (Request.Params[combo2.UniqueID] != null) return;
if (!grid.IsNewRowEditing) {
object[] vals = (object[])grid.GetRowValues(grid.EditingRowVisibleIndex,
new string[] { "Category2ID", "Category3ID", "Category4ID" });
ASPxComboBox combo4 = ((ASPxComboBox)grid.FindEditRowCellTemplateControl(
grid.Columns["Category4ID"] as GridViewDataComboBoxColumn, "Cat4"));
ASPxComboBox combo3 = ((ASPxComboBox)grid.FindEditRowCellTemplateControl(
grid.Columns["Category3ID"] as GridViewDataComboBoxColumn, "Cat3"));
combo2.Value = vals[0];
combo3.Value = vals[1];
combo4.Value = vals[2];
}
}
}
Hiç yorum yok:
Yorum Gönder