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

Does not enter insert mode

4 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 11 Aug 2008, 01:54 PM
Hello.

I am using some GridDropDownColumn and GridDropDownColumn to display, edit and insert data. This columns are half of the information I have to add, so I will perform a custom insert. The problem is the grid will not go in insert mode when I press the button in the CommandItemDisplay. Here is my code:

<telerik:RadGrid ID="FacturiGrid" runat="server" Width="100%" Skin="Web20" AutoGenerateColumns="False" 
                    GridLines="Horizontal"  AllowAutomaticInserts="True" AllowAutomaticUpdates="true" 
                    DataSourceID="BillServiceDS"  OnItemCommand="FacturiGrid_ItemCommand"
                    <MasterTableView EditMode="InPlace" CommandItemDisplay="Bottom"  
                        CommandItemSettings-AddNewRecordText="Adaug&#259;" 
                        CommandItemSettings-AddNewRecordImageUrl="../../../Images/add.gif"  
                        ShowHeadersWhenNoRecords="true" DataSourceID="BillServiceDS"  
                         > 
                        <NoRecordsTemplate> 
                            <div>Adaugati detalii factura</div> 
                       </NoRecordsTemplate> 
                         
                        <Columns> 
                            <telerik:GridDropDownColumn DataSourceID="ServiciiDS" 
                                DataField="ServiceId" ListTextField="Name" ListValueField="Id" 
                                HeaderText="Serviciu" DropDownControlType="RadComboBox" UniqueName="ServiciiDDC" /> 
                            <telerik:GridNumericColumn HeaderText="Cantitate" DataField="Units" 
                                UniqueName="CantiatateNC" NumericType="Number" /> 
                            <telerik:GridNumericColumn HeaderText="Pre&#539; unitar" DataField="UnitPrice" 
                                UniqueName="CantiatateNC" NumericType="Number" /> 
                            <telerik:GridCalculatedColumn HeaderText="Total" DataFields="Units, UnitPrice" 
                                UniqueName="TotalCC" Expression="{0}*{1}" /> 
                        </Columns> 
                         
                        <CommandItemSettings AddNewRecordText="Adaug&#259;" AddNewRecordImageUrl="../../../Images/add.gif"></CommandItemSettings> 
 
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px"></HeaderStyle> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn> 
                            <HeaderStyle Width="20px"></HeaderStyle> 
                        </ExpandCollapseColumn> 
                    </MasterTableView> 
                    <ClientSettings> 
                        <Selecting AllowRowSelect="True" /> 
                    </ClientSettings> 
                    <FilterMenu EnableTheming="True"
                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                    </FilterMenu> 
                </telerik:RadGrid> 

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Aug 2008, 09:03 AM
Hello Alex,

I suppose the problem is not in the declaration you posted here. I made an example based on your code and it seems that it does not prevent the RadGrid to go into Insert/Edit mode.

Best wishes,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Alex
Top achievements
Rank 1
answered on 12 Aug 2008, 09:23 AM
Hello Daniel,

I have looked over your demo and I see nothing I did wrong. Here is my full aspx page. In the aspx.cs I have nothing, and this is an independent page.

If I use databound columns, it works ok, but I want a custom controls on it. I have also tried using a template column and placing the combo box or other controls in the edittemplate, still the same thing. I have done this functionality on other pages, so I don't understand why this doesn't work here.

<%@ Page Language="C#" MasterPageFile="~/WebPages/admin/Admin.Master" AutoEventWireup="true" 
    CodeBehind="BillEntry.aspx.cs" Inherits="Imobile.WebPages.admin.dataentry.BillEntry" 
    Title="Introducere facturi" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="HeaderContent" runat="server"
    <style type="text/css"
        .rcbHeader ul, .rcbFooter ul, .rcbItem ul, .rcbHovered ul, .rcbDisabled ul 
        { 
            width: 100%; 
            display: inline-block; 
            margin: 0; 
            padding: 0; 
            list-style-type: none; 
        } 
        .rcbHeader ul:after, .rcbFooter ul:after, .rcbItem ul:after, .rcbHovered ul:after, .rcbDisabled ul:after 
        { 
            content: "."; 
            display: block; 
            visibility: hidden; 
            font-size: 0; 
            line-height: 0; 
            height: 0; 
            clear: both; 
        } 
        .col1, .col2, .col3, .col4 
        { 
            float: left; 
            width: 80px; 
            margin: 0; 
            padding: 0 5px 0 0; 
            line-height: 14px; 
        } 
    </style> 
</asp:Content> 
 
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server"
    <table width="100%"
        <tr> 
            <td align="left"
                <asp:Label runat="server" Text="Seria: " /> 
                <asp:TextBox runat="server" ID="TbSerieFactura" /> 
                <asp:Label runat="server" Text="  Nr. " /> 
                <asp:TextBox runat="server" ID="TbNumarFactura" /> 
            </td> 
        </tr> 
        <tr> 
            <td align="left"
                <asp:Label Text="Furnizor" runat="server" /> 
                <telerik:RadComboBox ID="DD" DataSourceID="FurnizoriDS" Skin="Vista" Width="400px" 
                    Height="130px" HighlightTemplatedItems="true" runat="server" 
                    DataTextField="Name" DataValueField="Id"
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                    <HeaderTemplate> 
                        <ul> 
                            <li class="col1">Nume</li> 
                            <li class="col3">Adresa</li> 
                            <li class="col4">email</li> 
                        </ul> 
                    </HeaderTemplate> 
                    <ItemTemplate> 
                        <ul> 
                            <li class="col1"
                                <%# DataBinder.Eval(Container.DataItem, "Name") %></li
                            
                            <li class="col3"
                                <%# DataBinder.Eval(Container.DataItem, "Street.Name")%>,  
                                <%# DataBinder.Eval(Container.DataItem, "Address")%> 
                           </li> 
                           <li class="col4"
                                <%# DataBinder.Eval(Container.DataItem, "Email")%> 
                            </li> 
                        </ul> 
                    </ItemTemplate> 
                </telerik:RadComboBox> 
            </td> 
        </tr> 
        <tr> 
            <td align="center"
                <asp:Label Font-Size="Large" Text="Factura" runat="server" /> 
            </td> 
        </tr> 
        <tr> 
            <td align="center"
                <asp:Label Text="Data: " runat="server" /> 
                <telerik:RadDatePicker ID="RadDatePicker1" runat="server" Skin="Web20"
                </telerik:RadDatePicker> 
            </td> 
        </tr> 
        <tr> 
            <td style="height: 25px"
            </td> 
        </tr> 
         
         
         
        <!-- Gridul de introducere detalii factura--> 
        <tr> 
            <td style="width: 100%;" align="center"
                <telerik:RadGrid ID="FacturiGrid" runat="server" Width="100%" Skin="Web20" AutoGenerateColumns="False" 
                    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 
                    AllowAutomaticDeletes="True" 
                    OnItemCommand="FacturiGrid_ItemCommand" ClientSettings-Scrolling-SaveScrollPosition="true"  
                    DataSourceID="BillServiceDS" > 
                    <MasterTableView EditMode="InPlace" CommandItemDisplay="Bottom"  
                        CommandItemSettings-AddNewRecordText="Adaug&#259;" 
                        CommandItemSettings-AddNewRecordImageUrl="../../../Images/add.gif"  
                        ShowHeadersWhenNoRecords="true" DataSourceID="BillServiceDS"  
                        DataKeyNames="Id" > 
                        <NoRecordsTemplate> 
                            <div>Adaugati detalii factura</div> 
                       </NoRecordsTemplate> 
                         
                        <CommandItemSettings AddNewRecordText="Adaug&#259;" AddNewRecordImageUrl="../../../Images/add.gif"></CommandItemSettings> 
 
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px"></HeaderStyle> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn> 
                            <HeaderStyle Width="20px"></HeaderStyle> 
                        </ExpandCollapseColumn> 
                        <Columns> 
                         
                              
                            <telerik:GridBoundColumn DataField="ServiceId" DataType="System.Int32"  
                                HeaderText="ServiceId" SortExpression="ServiceId" UniqueName="ServiceId"
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal"  
                                HeaderText="UnitPrice" SortExpression="UnitPrice" UniqueName="UnitPrice"
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Units" DataType="System.Decimal"  
                                HeaderText="Units" SortExpression="Units" UniqueName="Units"
                            </telerik:GridBoundColumn> 
                            <telerik:GridCalculatedColumn HeaderText="Total" DataFields="Units, UnitPrice" 
                                UniqueName="TotalCC" Expression="{0}*{1}" /> 
                             
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../../../Images/vcard_edit.gif" 
                                CancelImageUrl="../../../Images/cancel.gif" UpdateImageUrl="../../../Images/save.gif" 
                            /> 
                            <telerik:GridButtonColumn CommandName="Delete" ImageUrl="../../../Images/delete.gif" 
                                 ButtonType="ImageButton"/> 
                        </Columns> 
                    </MasterTableView> 
                    <ClientSettings> 
                        <Selecting AllowRowSelect="True" /> 
                    </ClientSettings> 
                    <FilterMenu EnableTheming="True"
                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                    </FilterMenu> 
                </telerik:RadGrid> 
            </td> 
        </tr> 
    </table> 
     
     
    <asp:LinqDataSource ID="FurnizoriDS" runat="server" ContextTypeName="DataAccesLayer.ImobileDataContext" 
        Select="new (Id, Name, Street, Street.Location, Email, Telephone, Address)" TableName="Suplayers"
    </asp:LinqDataSource> 
    <asp:LinqDataSource ID="ServiciiDS" runat="server"  
        ContextTypeName="DataAccesLayer.ImobileDataContext"  
        Select="new (Id, Name, BillDetailes, MuId, FlatPaymentListDetailes, FlatServices, EntranceServices, MersurementUnit, Counters)"  
        TableName="Services"
    </asp:LinqDataSource> 
    <asp:LinqDataSource ID="BillServiceDS" runat="server"  
        ContextTypeName="DataAccesLayer.ImobileDataContext" EnableInsert="True"  
        EnableDelete="true" EnableUpdate="true" 
        TableName="BillServices"
    </asp:LinqDataSource> 
     
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" 
        Width="75px" Transparency="1"
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
            style="border: 0px;" /> 
    </telerik:RadAjaxLoadingPanel> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="False"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="FacturiGrid"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="FacturiGrid" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
     
</asp:Content> 
<asp:Content ID="Content4" ContentPlaceHolderID="LeftPanel" runat="server"
</asp:Content> 
 

Thanks
0
Accepted
Daniel
Telerik team
answered on 14 Aug 2008, 12:42 PM
Hello Alex,

Please add an EditColumn to your MasterTableView and let me know whether this helps.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Alex
Top achievements
Rank 1
answered on 14 Aug 2008, 12:52 PM
Hello,

I have solved the problem by ... recreating the page. The same code, I just made a new grid with the help of the designer (witch I did numerous times on the old page). Very strange and it cost me 2 days.

Thanks for the interest!


Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Alex
Top achievements
Rank 1
Share this question
or