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

Radgrid inside EditFormSettings

5 Answers 438 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dennis
Top achievements
Rank 1
dennis asked on 27 Aug 2009, 08:33 PM
i Have a radgrid (rad1)  inside a FormTemplate of another RadGrid (rad2).

If i update a row in (rad1) while (rad2) is in editmode, the (rad1) UpdateCommand get only empty values. ,


how i can do it????

UPDATE: i found that this happen because NeedDataSource of (rad1) is beign called before UpdateCommand,
this doesnt happens if the radgrid is not inside of another RadGrid.


<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AutoGenerateColumns="False" 
        Skin="WebBlue" OnInsertCommand="RadGrid1_InsertCommand" OnItemDataBound="RadGrid1_ItemDataBound">  
        <MasterTableView CommandItemDisplay="Top" EditMode="PopUp" CommandItemSettings-AddNewRecordText="Agregar Estándar" 
            CommandItemSettings-RefreshText="">  
            <RowIndicatorColumn>  
                <HeaderStyle Width="20px"></HeaderStyle>  
            </RowIndicatorColumn>  
            <ExpandCollapseColumn>  
                <HeaderStyle Width="20px"></HeaderStyle>  
            </ExpandCollapseColumn>  
            <Columns>  
                <telerik:GridBoundColumn DataField="ID" UniqueName="ID" Display="false" />  
                <telerik:GridBoundColumn DataField="Ciudad" UniqueName="Ciudad" HeaderText="Ciudad" />  
                <telerik:GridBoundColumn DataField="Aeropuerto" UniqueName="Aeropuerto" HeaderText="Aeropuerto" />  
                <telerik:GridBoundColumn DataField="Proceso" UniqueName="Proceso" HeaderText="Proceso" />  
            </Columns>  
            <EditFormSettings EditFormType="Template" PopUpSettings-Modal="true" PopUpSettings-Width="500px" 
                CaptionFormatString="Insertar nueva propiedad">  
                <FormTemplate>  
                    <center>  
                        <table style="text-align: left">  
                            <tr>  
                                <td>  
                                    <br />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    <asp:Literal ID="Literal4" runat="server" Text="Aerolinea" />  
                                </td>  
                                <td>  
                                    <telerik:RadComboBox ID="RadComboBoxAeronave" runat="server" DataTextField="Aeronave" 
                                        DataValueField="ID" Skin="WebBlue" DataSourceID="ObjectDataSourceAeronave" OnClientSelectedIndexChanged="LoadValores" />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    <asp:Literal ID="Literal3" runat="server" Text="Modelo Avión" />  
                                </td>  
                                <td>  
                                    <telerik:RadComboBox ID="RadComboBoxTipoAvion" runat="server" Skin="WebBlue" DataTextField="DE_NAVE" 
                                        DataValueField="ID_NAVE" OnItemsRequested="RadComboBoxTipoAvion_ItemsRequested" 
                                        OnClientItemsRequested="ItemsLoaded" EmptyMessage="Seleccione Aerolinea..." />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    <asp:Literal ID="Literal2" runat="server" Text="Aeropuerto" />  
                                </td>  
                                <td>  
                                    <telerik:RadComboBox ID="RadComboBoxAeropuerto" runat="server" DataTextField="Aeropuerto" 
                                        DataValueField="ID" Skin="WebBlue" DataSourceID="ObjectDataSourceAeropuerto" />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    <asp:Literal ID="Literal1" runat="server" Text="Proceso" />  
                                </td>  
                                <td>  
                                    <telerik:RadComboBox ID="RadComboBoxProcesos" runat="server" DataSourceID="EntityDataSourceProcesos" 
                                        DataTextField="DE_PROC" DataValueField="ID_PROC" Skin="WebBlue" />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    &nbsp;  
                                </td>  
                                <td>  
                                    <asp:CheckBox Text="Activo" ID="CheckBox1" runat="server" Checked="true" />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    <br />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td colspan="2">  
                                    <telerik:RadGrid ID="RadGridStandards" AutoGenerateColumns="false" Skin="WebBlue" 
                                        OnNeedDataSource="RadGridStandards_NeedDataSource" GridLines="None" runat="server" 
                                        AllowMultiRowSelection="True" AllowMultiRowEdit="True"   
                                        OnUpdateCommand="RadGridStandards_UpdateCommand" OnItemDataBound="RadGridStandards_ItemDataBound" 
                                        AllowAutomaticUpdates="false">  
                                        <MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="false" EditFormSettings-EditFormType="AutoGenerated" 
                                            EditMode="InPlace" DataKeyNames="ID">  
                                            <CommandItemTemplate>  
                                                <div style="padding: 5px 5px;">  
                                                    <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGridStandards.EditIndexes.Count == 0 %>'>Editar</asp:LinkButton>&nbsp;&nbsp;  
                                                    <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGridStandards.EditIndexes.Count > 0 %>'>Actualizar</asp:LinkButton>&nbsp;&nbsp;  
                                                    <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGridStandards.EditIndexes.Count > 0 || RadGridStandards.MasterTableView.IsItemInserted %>'>Cancelar</asp:LinkButton>  
                                                </div>  
                                            </CommandItemTemplate>  
                                            <Columns>  
                                                <telerik:GridBoundColumn DataField="ID" UniqueName="ID" Display="false" ReadOnly="true" />  
                                                <telerik:GridBoundColumn DataField="TipoActividad" UniqueName="TipoActividad" HeaderText="Tipo" 
                                                    ReadOnly="true" />  
                                                <telerik:GridBoundColumn DataField="Actividad" UniqueName="Actividad" HeaderText="Actividad" 
                                                    ReadOnly="true" />  
                                                <telerik:GridTemplateColumn UniqueName="Drop" HeaderText="Base" DataField="Drop">  
                                                    <ItemTemplate>  
                                                        <asp:Literal ID="Literal1" runat="server" Text='<%#Eval("Drop") %>' />  
                                                    </ItemTemplate>  
                                                    <EditItemTemplate>  
                                                        <telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="WebBlue" DataSourceID="EntityDataSourceProcesosActividad" 
                                                            DataValueField="ID_ACTI" DataTextField="DE_ACTI" Width="50px" SelectedValue='<%#Bind("Drop") %>' />  
                                                    </EditItemTemplate>  
                                                </telerik:GridTemplateColumn>  
                                                <telerik:GridTemplateColumn UniqueName="Numeric" HeaderText="Tiempos" DataField="Numeric">  
                                                    <ItemTemplate>  
                                                        <asp:Literal ID="Literal2" runat="server" Text='<%#Eval("Numeric") %>' />  
                                                    </ItemTemplate>  
                                                    <EditItemTemplate>  
                                                        <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" Skin="WebBlue" 
                                                            Type="Number" ShowSpinButtons="true" IncrementSettings-InterceptArrowKeys="true" 
                                                            NumberFormat-DecimalDigits="0" IncrementSettings-InterceptMouseWheel="true" Width="50px" 
                                                            DbValue='<%# Bind("Numeric") %>' />  
                                                    </EditItemTemplate>  
                                                </telerik:GridTemplateColumn>  
                                                <telerik:GridTemplateColumn UniqueName="Check" HeaderText="Activo" DataField="Check">  
                                                    <ItemTemplate>  
                                                        <asp:Literal ID="Literal3" runat="server" Text='<%#Eval("Check") %>' />  
                                                    </ItemTemplate>  
                                                    <EditItemTemplate>  
                                                        <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("Check") %>' />  
                                                    </EditItemTemplate>  
                                                </telerik:GridTemplateColumn>  
                                            </Columns>  
                                        </MasterTableView>  
                                        <ClientSettings>  
                                            <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />  
                                        </ClientSettings>  
                                    </telerik:RadGrid>  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    <br />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td colspan="2" align="right">  
                                    <asp:LinkButton ID="LinkButton1" runat="server" Text="Aceptar" CommandName="PerformInsert" /><asp:Literal  
                                        ID="LiteralSpace" runat="server" Text="  " /><asp:LinkButton ID="LinkButton2" runat="server" 
                                            Text="Cancelar" CommandName="Cancel" CausesValidation="False" />  
                                </td>  
                            </tr>  
                            <tr>  
                                <td>  
                                    <br />  
                                </td>  
                            </tr>  
                        </table>  
                    </center>  
                </FormTemplate>  
                <PopUpSettings Modal="True"></PopUpSettings>  
            </EditFormSettings>  
        </MasterTableView>  
    </telerik:RadGrid> 

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 31 Aug 2009, 02:26 PM
Hi Dennis,

In order to achieve the desired functionality, please refer to the following forum post which elaborates on similar subject and let me know if you have other questions or problems:
http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-inside-nestedviewtemplate-of-another-dynamic-radgrid.aspx

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kalpna
Top achievements
Rank 1
answered on 24 Jul 2013, 05:08 AM
Hello, I want to find radgrid which is inside the editformsetting using c# in needdatasource of inner radgrid. Please help me.
0
Princy
Top achievements
Rank 2
answered on 24 Jul 2013, 07:34 AM
Hi Kalpna,

The NeedDataSource event is too early to get reference of the controls inside the RadGrid edit form. You can access the controls in ItemDataBound or ItemCreated event. Please have a look into this documentation to know more about the RadGrid Event Sequence. Please check the following I tried to access an item in the ItemDataBound event.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem EditItem = (GridEditableItem)e.Item;
        //access the RadGrid Here
    }
}

Thanks,
Princy.
0
sara r
Top achievements
Rank 1
answered on 07 Feb 2014, 05:00 AM
i Have a radgrid (rad1)  inside a FormTemplate of another RadGrid (rad2), inside a FormTemplate of rad2, another RadGrid (rad3) similar to the condition mentioned here.
rad1
<EditFormSettings EditFormType="Template">
                                <FormTemplate>
                                    <div id="divRad2" 
                                       <rad2>
                                         <EditFormSettings EditFormType="Template">
                                           <FormTemplate>
                                             <div id="divRad3" 
                                                 <rad3>
                                                    ----
                                                    ----
Like that it flows. On click on edit in rad1, in the rad1_ItemDataBound, divRad2 is made visible and rad2 is bound and shown. Another edit on rad2, followed the same way... in the rad2_ItemDataBound, divRad3 is made visible and rad3 is getting bound, but it is not getting displayed. After rad2_ItemDataBound, rad3 bounds while debugging, but the grid rad1 gets collapsed, it is not even showing rad2. Please help with a ay solving this.



0
Pavlina
Telerik team
answered on 11 Feb 2014, 04:27 PM
Hello Sara,

Can you submit a support ticket and attach an isolated project where the described problem can be observed? We will debug it locally and will advice you further.

Regards,
Pavlina
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
dennis
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Kalpna
Top achievements
Rank 1
Princy
Top achievements
Rank 2
sara r
Top achievements
Rank 1
Share this question
or