.ASPX
<dx:ASPxGridView ID="gvParent" runat="server" AutoGenerateColumns="False" Width="100%"
ClientInstanceName="gvParent" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
CssPostfix="DevEx" DataSourceID="odsParent" KeyFieldName="ID_COMPROMISO">
<Settings ShowFilterRow="true" />
<SettingsPager PageSize="25">
</SettingsPager>
<Columns>
<dx:GridViewCommandColumn Width="50px" ButtonType="Image" CellStyle-Font-Size="9px"
VisibleIndex="0" Caption=" ">
<EditButton Text="Editar" Image-Url="../../images/layer_edit.png" Visible="true">
<Image Url="../../images/layer_edit.png">
</Image>
</EditButton>
<CancelButton Text="Cancelar" Image-Url="../../images/cancelar.png" Visible="true">
<Image Url="../../images/cancelar.png">
</Image>
</CancelButton>
<UpdateButton Text="Grabar" Image-Url="../../images/save.png" Visible="false">
<Image Url="../../images/save.png">
</Image>
</UpdateButton>
<DeleteButton Text="true" Image-Url="../../images/map_remove.png" Visible="False">
<Image Url="../../images/map_remove.png">
</Image>
</DeleteButton>
<ClearFilterButton Visible="True" Image-Url="../../images/broom-icon.png">
<Image Url="../../images/broom-icon.png">
</Image>
</ClearFilterButton>
<CellStyle Font-Size="9px">
</CellStyle>
</dx:GridViewCommandColumn>
<dx:GridViewDataTextColumn FieldName="ID_COMPROMISO" VisibleIndex="3" Visible="False"
Caption="ID_COMPROMISO">
</dx:GridViewDataTextColumn>
<dx:GridViewDataComboBoxColumn Caption="MINUTA ASOCIADA" FieldName="ID_MINUTA" ToolTip="Para Ingresar Minutas vea --> Gestion Proyectos> Minutas"
VisibleIndex="2">
<PropertiesComboBox DataSourceID="odsMinuta" ValueField="ID_MINUTA" TextField="NOMBRE_MINUTA"
IncrementalFilteringMode="StartsWith" Spacing="0">
</PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
<dx:GridViewDataMemoColumn FieldName="DESCRIPCION_COMPROMISO" VisibleIndex="2" ReadOnly="False"
Caption="COMPROMISO">
<PropertiesMemoEdit MaxLength="1000" Height="80px">
</PropertiesMemoEdit>
</dx:GridViewDataMemoColumn>
<dx:GridViewDataDateColumn FieldName="FECHA_INICIO_COMPROMISO" ShowInCustomizationForm="True"
VisibleIndex="3" Width="100px" Caption="FECHA INICIO COMP." HeaderStyle-HorizontalAlign="Center"
CellStyle-HorizontalAlign="Center">
<EditFormSettings Visible="True" />
<PropertiesDateEdit DisplayFormatString="dd/MM/yyyy">
</PropertiesDateEdit>
<HeaderStyle Wrap="False" />
<CellStyle Wrap="False">
</CellStyle>
</dx:GridViewDataDateColumn>
<dx:GridViewDataDateColumn FieldName="FECHA_COMPROMETIDA_COMPROMISO" ShowInCustomizationForm="True"
VisibleIndex="4" Width="100px" Caption="FECHA COMPROMETIDA COMP." HeaderStyle-HorizontalAlign="Center"
CellStyle-HorizontalAlign="Center">
<EditFormSettings Visible="True" />
<PropertiesDateEdit DisplayFormatString="dd/MM/yyyy">
</PropertiesDateEdit>
<HeaderStyle Wrap="False" />
<CellStyle Wrap="False">
</CellStyle>
</dx:GridViewDataDateColumn>
<dx:GridViewDataDateColumn FieldName="FECHA_REAL_TERMINO_COMPROMISO" ShowInCustomizationForm="True"
VisibleIndex="5" Width="100px" Caption="FECHA REAL TÉRMINO COMP." HeaderStyle-HorizontalAlign="Center"
CellStyle-HorizontalAlign="Center">
<EditFormSettings Visible="True" />
<PropertiesDateEdit DisplayFormatString="dd/MM/yyyy">
</PropertiesDateEdit>
<HeaderStyle Wrap="False" />
<CellStyle Wrap="False">
</CellStyle>
</dx:GridViewDataDateColumn>
<dx:GridViewDataMemoColumn FieldName="TIPO_COMPROMISO" VisibleIndex="7" ReadOnly="False"
Caption="TIPO COMPROMISO">
<PropertiesMemoEdit MaxLength="50" Height="80px">
</PropertiesMemoEdit>
</dx:GridViewDataMemoColumn>
<dx:GridViewDataComboBoxColumn FieldName="ESTADO" VisibleIndex="8">
<PropertiesComboBox ValueType="System.String" IncrementalFilteringMode="StartsWith"
Spacing="0">
<Items>
<dx:ListEditItem Text="ACTIVO" Value="1" />
<dx:ListEditItem Text="INACTIVO" Value="0" />
</Items>
</PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
</Columns>
<SettingsBehavior AllowFocusedRow="true" />
<Images SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
<LoadingPanelOnStatusBar Url="~/App_Themes/DevEx/GridView/StatusBarLoading.gif">
</LoadingPanelOnStatusBar>
<LoadingPanel Url="~/App_Themes/Styles/img/icons/loading.gif">
</LoadingPanel>
</Images>
<ImagesFilterControl>
<LoadingPanel Url="~/App_Themes/Styles/img/icons/loading.gif">
</LoadingPanel>
</ImagesFilterControl>
<Styles CssPostfix="DevEx" CssFilePath="~/App_Themes/DevEx/{0}/styles.css">
<Header ImageSpacing="5px" SortingImageSpacing="5px">
</Header>
<LoadingPanel ImageSpacing="5px">
</LoadingPanel>
</Styles>
<StylesEditors ButtonEditCellSpacing="0">
<ProgressBar Height="21px">
</ProgressBar>
</StylesEditors>
</dx:ASPxGridView>
.CS
protected void Page_Init(object sender, EventArgs e)
{
gvParent.InitNewRow += gvParent_InitNewRow;
gvParent.CustomCallback += GvParentCustomCallback;
gvParent.RowValidating += GvParentRowValidating;
gvParent.RowInserting += gvParent_RowInserting;
gvParent.RowUpdating += gvParent_RowUpdating;
gvParent.ParseValue += gvParent_ParseValue;
gvParent.CustomErrorText += gvParent_CustomErrorText;
odsMinuta.Selecting += odsMinuta_Selecting;
}
void GvParentRowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
{
foreach (GridViewColumn column in gvParent.Columns)
{
var dataColumn = column as GridViewDataColumn;
if (dataColumn == null) continue;
switch (dataColumn.FieldName)
{
case "ID_MINUTA":
if (e.NewValues["ID_MINUTA"] == null)
{
e.Errors[dataColumn] = "Campo requerido";
}
break;
case "DESCRIPCION_COMPROMISO":
if (e.NewValues["DESCRIPCION_COMPROMISO"] == null)
{
e.Errors[dataColumn] = "Campo requerido";
}
break;
case "FECHA_INICIO_COMPROMISO":
if (e.NewValues["FECHA_INICIO_COMPROMISO"] == null)
{
e.Errors[dataColumn] = "Campo requerido";
}
break;
case "FECHA_COMPROMETIDA_COMPROMISO":
if (e.NewValues["FECHA_COMPROMETIDA_COMPROMISO"] == null)
{
e.Errors[dataColumn] = "Campo requerido";
}
break;
case "TIPO_COMPROMISO":
if (e.NewValues["TIPO_COMPROMISO"] == null)
{
e.Errors[dataColumn] = "Campo requerido";
}
break;
case "ESTADO":
if (e.NewValues["ESTADO"] == null)
{
e.Errors[dataColumn] = "Campo requerido";
}
break;
}
}
}
No hay comentarios:
Publicar un comentario