This is a migrated thread and some comments may be shown as answers.

UpdateCommand is not called

3 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jaime
Top achievements
Rank 1
Jaime asked on 08 Jan 2009, 07:43 PM
Hello...

I have a RadGridView in an ASPX page. In the edit form template I placed a table with a lot of fields and a "save" button. That "save" button has the "Update" CommandName.

When that button si clicked, ItemCommand event is called. When I debug the code, e.CommandName value is "Update" which is right. After the ItemCommand method returns, UpdateCommand method is not executed.

What may be happening here? what is intercepting so that UpdateCommand is not executed right after ItemCommand?

Thanks in advance
Jaime

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Jan 2009, 06:55 AM
Hi Jaime,

The UpdateCommand must get called on clicking the Save button since you have set the CommandName of the button as Update. It would be better if you could send the aspx aswell.

Shinu
0
Jaime
Top achievements
Rank 1
answered on 09 Jan 2009, 01:20 PM
That's why I don't know why onle ItemCommand is called and not Updatecommand.

This is the GridView definition:


        <rad:RadGrid ID="grdMails" runat="server" GridLines="None" 
            OnItemCommand="grdMails_ItemCommand" Skin="WebBlue" GroupingEnabled="False" Width="95%" OnEditCommand="grdMails_EditCommand" OnItemDataBound="grdMails_ItemDataBound" OnUpdateCommand="grdMails_UpdateCommand" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" EnableAJAX="True" OnCancelCommand="grdMails_CancelCommand">  
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="Codigo" NoMasterRecordsText="No existen mails pendientes de ser enviados" AutoGenerateColumns="False">  
                <CommandItemSettings AddNewRecordText="Agregar mail" RefreshText="" /> 
                <Columns> 
                    <rad:GridBoundColumn DataField="Asunto" HeaderText="Nombre" UniqueName="Nombre">  
                        <ItemStyle Width="50%" /> 
                    </rad:GridBoundColumn> 
                    <rad:GridBoundColumn DataField="FechaAgenda" Groupable="False" HeaderText="Fecha Agenda" 
                        UniqueName="column1">  
                        <ItemStyle Width="15%" /> 
                    </rad:GridBoundColumn> 
                    <rad:GridBoundColumn DataField="FechaCreacion" Groupable="False" HeaderText="Fecha Creaci&#243;n" 
                        UniqueName="column2">  
                        <ItemStyle Width="15%" /> 
                    </rad:GridBoundColumn> 
                    <rad:GridEditCommandColumn ButtonType="ImageButton" CancelText="Cancelar" EditText="Editar" 
                        InsertText="Insertar" UpdateText="Actualizar">  
                        <ItemStyle Width="20%" /> 
                    </rad:GridEditCommandColumn> 
                </Columns> 
                <EditFormSettings EditFormType="Template">  
                    <FormTemplate> 
                        <table border="0" style="width: 100%; background-color: #ffffff; text-align: left; border: solid 2px #BBBBBB">  
                            <tr> 
                                <td class="label" style="width: 15%">Asunto</td> 
                                <td style="width: 85%"><asp:TextBox CssClass="texto" MaxLength="512" Columns="50" ID="txtAsunto" Text='<%# Bind("Asunto") %>' runat="server"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtAsunto" 
                                        Display="Dynamic" ErrorMessage="Debe ingresar el asunto del mail" SetFocusOnError="True">*</asp:RequiredFieldValidator></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Mail Desde</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="50" Columns="50" ID="txtDesde" Text='<%# Bind("Desde") %>' runat="server"></asp:TextBox>&nbsp;<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtDesde" 
                                        ErrorMessage="El e-mail fue ingresado incorrectamnte" SetFocusOnError="True" 
                                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic">*</asp:RegularExpressionValidator><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtDesde" 
                                        Display="Dynamic" ErrorMessage="Debe ingresar la dirección de e-mail de origen" SetFocusOnError="True">*</asp:RequiredFieldValidator></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Mail Responder a</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="50" Columns="50" ID="txtResponderA" Text='<%# Bind("Responder") %>' runat="server"></asp:TextBox>&nbsp;<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtResponderA" 
                                        ErrorMessage="El e-mail fue ingresado incorrectamnte" SetFocusOnError="True" 
                                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic">*</asp:RegularExpressionValidator></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Mail Para</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="1024" Columns="50" ID="txtPara" Text='<%# Bind("Para") %>' runat="server"></asp:TextBox></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Mail CC</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="1024" Columns="50" ID="txtCC" Text='<%# Bind("CC") %>' runat="server"></asp:TextBox></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Mail CCO</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="1024" Columns="50" ID="txtCCO" Text='<%# Bind("CCO") %>' runat="server"></asp:TextBox></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Fecha Agenda</td> 
                                <td> 
                                    <FW:SelectorFecha ID="dpFechaAgenda" runat="server" InsertJavaScriptIncludes="False" 
                                        PopupImageUrl="~/Private/images/datePickerPopup.gif" JavaScriptUrl="~/js/calendar">  
                                        <TextBoxStyle CssClass="texto" /> 
                                    </FW:SelectorFecha>&nbsp;<asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="dpFechaAgenda" 
                                        ErrorMessage="La fecha de agendamiento fue mal ingresada" Operator="DataTypeCheck" 
                                        SetFocusOnError="True" Type="Date" CultureInvariantValues="True">*</asp:CompareValidator></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Reintentos Permitidos</td> 
                                <td> 
                                    <asp:TextBox ID="txtReintentos" runat="server" Columns="3" CssClass="texto" MaxLength="2" 
                                        Text='<%# Bind("Reintentos") %>'></asp:TextBox></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Horario Inicio</td> 
                                <td> 
                                    <asp:TextBox ID="txtHoraIni" runat="server" Columns="2" CssClass="texto" MaxLength="2"></asp:TextBox>:<asp:TextBox ID="txtMinIni" runat="server" Columns="2" CssClass="texto" 
                                            MaxLength="2" Text=""></asp:TextBox>&nbsp;<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtHoraIni" 
                                        ErrorMessage="Las horas deben estar entre 0 y 23" MaximumValue="23" MinimumValue="0" 
                                        SetFocusOnError="True" Type="Integer" Display="Dynamic">*</asp:RangeValidator><asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="txtMinIni" 
                                        ErrorMessage="Los minutos deben estar entre 0 y 59." MaximumValue="59" MinimumValue="0" 
                                        SetFocusOnError="True" Type="Integer" Display="Dynamic">*</asp:RangeValidator></td>  
                            </tr> 
                            <tr> 
                                <td class="label" style="height: 21px">Horario Término</td> 
                                <td style="height: 21px">  
                                    <asp:TextBox ID="txtHoraFin" runat="server" Columns="2" CssClass="texto" MaxLength="2" 
                                        Text=""></asp:TextBox>:<asp:TextBox ID="txtMinFin" runat="server" Columns="2" CssClass="texto" 
                                            MaxLength="2" Text=""></asp:TextBox>&nbsp;<asp:RangeValidator ID="RangeValidator3" runat="server" ControlToValidate="txtHoraFin" 
                                        ErrorMessage="Las horas deben estar entre 0 y 23" MaximumValue="23" MinimumValue="0" 
                                        SetFocusOnError="True" Type="Integer" Display="Dynamic">*</asp:RangeValidator><asp:RangeValidator ID="RangeValidator4" runat="server" ControlToValidate="txtMinFin" 
                                        ErrorMessage="Los minutos deben estar entre 0 y 59." MaximumValue="59" MinimumValue="0" 
                                        SetFocusOnError="True" Type="Integer" Display="Dynamic">*</asp:RangeValidator></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Archivos Adjuntos</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="1024" Columns="100" ID="txtArchivosAdjuntos" Text='<%# Bind("ArchivosAdjuntos") %>' runat="server"></asp:TextBox></td>  
                            </tr> 
                            <tr> 
                                <td class="label">Imágenes Embebidas</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="1024" Columns="100" ID="txtImagenesEmbebidas" Text='<%# Bind("ImagenesEmbebidas") %>' runat="server"></asp:TextBox></td>  
                            </tr> 
                            <tr style="vertical-align: top">  
                                <td class="label">Texto Plano</td> 
                                <td><asp:TextBox CssClass="texto" MaxLength="4000" Columns="110" ID="txtTextoPlano" Text='<%# Bind("Texto") %>' runat="server" Rows="10" TextMode="MultiLine"></asp:TextBox></td>  
                            </tr> 
                            <tr style="vertical-align: top">  
                                <td class="label">Texto HTML</td> 
                                <td> 
                                    <rad:RadEditor ID="txtTextoHtml" runat="server" ConvertToXhtml="False" DocumentsFilters="*.*" EnableClientSerialize="True" EnableContextMenus="True" EnableDocking="True" EnableEnhancedEdit="True" EnableHtmlIndentation="True" EnableServerSideRendering="True" EnableTab="True" ImagesFilters="*.gif,*.xbm,*.xpm,*.png,*.ief,*.jpg,*.jpe,*.jpeg,*.tiff,*.tif,*.rgb,*.g3f,*.xwd,*.pict,*.ppm,*.pgm,*.pbm,*.pnm,*.bmp,*.ras,*.pcd,*.cgm,*.mil,*.cal,*.fif,*.dsf,*.cmx,*.wi,*.dwg,*.dxf,*.svf" MediaFilters="*.asf,*.asx,*.wm,*.wmx,*.wmp,*.wma,*.wax,*.wmv,*.wvx,*.avi,*.wav,*.mpeg,*.mpg,*.mpe,*.mov,*.m1v,*.mp2,*.mpv2,*.mp2v,*.mpa,*.mp3,*.m3u,*.mid,*.midi,*.rm,*.rma,*.rmi,*.rmv,*.aif,*.aifc,*.aiff,*.au,*.snd" OnClientCancel="" OnClientCommandExecuted="" OnClientCommandExecuting="" OnClientInit="" OnClientLoad="" OnClientModeChange="" OnClientSubmit="" PassSessionData="True" RenderAsTextArea="False" Skin="WebBlue" SpellEditDistance="1" TemplateFilters="*.html,*.htm" ToolbarMode="Default" ToolsWidth="" Width="90%" Language="es-CL" ShowSubmitCancelButtons="False" ThumbSuffix="thumb">  
                                    </rad:RadEditor> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td colspan="2"><asp:ImageButton ID="btnAlmacenarMail" AlternateText="Almacenar" runat="server" ImageUrl="~/images/almacenar.gif" CommandName="Update" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                                                    <asp:ImageButton ID="btnVolver" AlternateText="Volver" runat="server" CausesValidation="false" ImageUrl="~/images/volver.gif" CommandName="Cancel" /></td>  
                            </tr> 
                        </table> 
                    </FormTemplate> 
                    <EditColumn UniqueName="EditCommandColumn1">  
                    </EditColumn> 
                </EditFormSettings> 
                <RowIndicatorColumn Visible="False">  
                    <HeaderStyle Width="20px" /> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn Resizable="False" Visible="False">  
                    <HeaderStyle Width="20px" /> 
                </ExpandCollapseColumn> 
            </MasterTableView> 
            <GroupingSettings CollapseTooltip="Colapsar Grupo" ExpandTooltip="Expandir grupo" /> 
            <HeaderStyle ForeColor="Gainsboro" HorizontalAlign="Center" /> 
            <ItemStyle HorizontalAlign="Left" /> 
            <AlternatingItemStyle HorizontalAlign="Left" /> 
        </rad:RadGrid> 
 

Do you see any strange?

Jaime

0
Shinu
Top achievements
Rank 2
answered on 12 Jan 2009, 06:48 AM
Hello Jaime,

I copied your above given code and tried it on my end it. I also had a similar experience. Try removing the RegularExpressionValidator from the FormTemplate and see whether the UpdateCommand is getting fired.

Shinu
Tags
Grid
Asked by
Jaime
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jaime
Top achievements
Rank 1
Share this question
or