GridInsertionObject missing property on Cancel operation

4 posts, 0 answers
  1. Jan Pfeffer
    Jan Pfeffer avatar
    55 posts
    Member since:
    Aug 2006

    Posted 22 Jul 2010 Link to this post

    Hey at Telerik

    I have a bit of a problem. I have a RadGrid with EditTemplate Columns.

    I try to add a new Container and all goes well. I have implemented the GridInsertionObject like you described in order to avoid the missing property error.

    When i Cancel the Insert operation i get the same error 'Telerik.WebControls.GridInsertionObject does not contain a property with the name mapviewer_Container1’ Error
    I have attached a screendump of the error.

    I have includded RadGridContainers_ItemCommand event at the bottom but as you can see from the code in it i have tried different scenarios with no luck.

     

     


    <telerik:RadGrid ID="RadGridContainers" runat="server" Skin="Office2007" AllowSorting="True"

     

     

     

    GridLines="None" AllowMultiRowSelection="True" OnNeedDataSource="RadGridContainers_NeedDataSource"

     

     

     

    Width="800px" Visible="False" ShowStatusBar="True" OnItemCommand="RadGridContainers_ItemCommand"

     

     

     

    OnCancelCommand="RadGridContainers_CancelCommand"

     

     

    AutoGenerateColumns="False"

     

     

    onitemdatabound="RadGridContainers_ItemDataBound">

     

     

     

    <MasterTableView AllowMultiColumnSorting="True" CommandItemDisplay="Top"

     

     

     

    DataKeyNames="ContainerID" EditMode="InPlace">

     

     

     

    <CommandItemSettings AddNewRecordText="Tilfj ny container" RefreshText="Opdatr" />

     

     

     

    <Columns>

     

     

     

    <telerik:GridEditCommandColumn CancelText="Annullr" InsertText="Indst" UpdateText="Opdatr"

     

     

     

    EditText="Redigr">

     

     

     

    </telerik:GridEditCommandColumn>

     

     

     

    <telerik:GridBoundColumn DataField="ContainerID" DataType="System.Int32" HeaderText="ContainerID"

     

     

     

    ReadOnly="True" SortExpression="ContainerID" UniqueName="ContainerID" Visible="False">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridTemplateColumn DataField="ContainerIDParent" DataType="System.Int32"

     

     

     

    HeaderText="Forldre" SortExpression="ContainerIDParent" UniqueName="ContainerIDParent"

     

     

     

    Visible="True">

     

     

     

    <EditItemTemplate>

     

     

     

    <table cellpadding="0" cellspacing="0">

     

     

     

    <tr>

     

     

     

    <td>

     

     

     

    <img id="rcbContainerIDParentEditImage" src='<%= ImageController.Instance.ImagePathTreeViewRaw %><%# Eval("mapviewer_Container1.mapviewer_Icon.Icon")%>'

     

     

     

    alt="" width="16px" height="16px" />

     

     

     

    </td>

     

     

     

    <td align="left">

     

     

     

    <telerik:RadComboBox ID="rcbContainerIDParent" runat="server" Skin="Office2007" MarkFirstMatch="True"

     

     

     

    HighlightTemplatedItems="True" DropDownWidth="500px" Height="200px" DataSourceID="LinqDataSource7"

     

     

     

    DataTextField="Name" Width="204px" DataValueField="ContainerID"

     

     

     

    OnClientSelectedIndexChanged="rcbContainerIDParentSelectedIndexChanged" SelectedValue='<%# Bind("mapviewer_Container1.ContainerID") %>'>

     

     

     

    <CollapseAnimation Duration="200" Type="OutQuint" />

     

     

     

    <HeaderTemplate>

     

     

     

    <table cellpadding="0" cellspacing="0" style="width: 290px;">

     

     

     

    <tr>

     

     

     

    <td style="width: 30px;">

     

     

     

    Id

     

     

    </td>

     

     

     

    <td style="width: 60px">

     

     

     

    Billede

     

     

    </td>

     

     

     

    <td style="width: 200px;">

     

     

     

    Navn

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </HeaderTemplate>

     

     

     

    <ItemTemplate>

     

     

     

    <table cellpadding="0" cellspacing="0" style="width: 290px;">

     

     

     

    <tr>

     

     

     

    <td style="width: 30px;">

     

     

     

    <%# Eval("ContainerID")%>

     

     

    </td>

     

     

     

    <td style="width: 60px;">

     

     

     

    <img src='<%= ImageController.Instance.ImagePathTreeViewRaw %><%# Eval("mapviewer_Icon.Icon")%>'

     

     

     

    alt="" width="16px" height="16px" />

     

     

     

    </td>

     

     

     

    <td style="width: 200px;">

     

     

     

    <%# Eval("Name")%>

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </ItemTemplate>

     

     

     

    </telerik:RadComboBox>

     

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </EditItemTemplate>

     

     

     

    <ItemTemplate>

     

     

     

    <table cellpadding="0" cellspacing="0" border="0">

     

     

     

    <tr>

     

     

     

    <td style="border: 0;">

     

     

     

    <asp:Image ID="rcbIkonEditImageContainer" ImageUrl='<%# ImageController.Instance.ImagePathTreeViewForGridView((string)Eval("mapviewer_container1.mapviewer_Icon.Icon"))%>'

     

     

     

    runat="server" Width="16px" Height="16px" />

     

     

     

    </td>

     

     

     

    <td style="border: 0;">

     

     

     

    <asp:Label ID="ContainerIDLabel" runat="server" Text='<%# Eval("mapviewer_container1.Name") %>'></asp:Label>

     

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </ItemTemplate>

     

     

     

    </telerik:GridTemplateColumn>

     

     

     

    <telerik:GridBoundColumn DataField="Name" HeaderText="Navn" SortExpression="Name"

     

     

     

    UniqueName="Name">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="Level" DataType="System.Int32" HeaderText="Level"

     

     

     

    SortExpression="Level" UniqueName="Level" Visible="False">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridTemplateColumn DataField="IconID" DataType="System.Int32" HeaderText="Ikon"

     

     

     

    SortExpression="IconID" UniqueName="IconID" Visible="True">

     

     

     

    <EditItemTemplate>

     

     

     

    <table cellpadding="0" cellspacing="0">

     

     

     

    <tr>

     

     

     

    <td>

     

     

     

    <img id="rcbIkonEditImage" src='<%= ImageController.Instance.ImagePathTreeViewRaw %><%# Eval("mapviewer_Icon.Icon")%>'

     

     

     

    alt="" width="16px" height="16px" />

     

     

     

    </td>

     

     

     

    <td align="left">

     

     

     

    <telerik:RadComboBox ID="rcbIkon" runat="server" Skin="Office2007" MarkFirstMatch="True"

     

     

     

    HighlightTemplatedItems="True" DropDownWidth="500px" Height="200px" DataSourceID="LinqDataSource1"

     

     

     

    DataTextField="Icon" Width="204px" DataValueField="IconID"

     

     

     

    OnClientSelectedIndexChanged="rcbIkonSelectedIndexChanged" SelectedValue='<%# Bind("mapviewer_Icon.IconID") %>'>

     

     

     

    <CollapseAnimation Duration="200" Type="OutQuint" />

     

     

     

    <HeaderTemplate>

     

     

     

    <table cellpadding="0" cellspacing="0" style="width: 190px;">

     

     

     

    <tr>

     

     

     

    <td style="width: 30px;">

     

     

     

    Id

     

     

    </td>

     

     

     

    <td style="width: 60px;">

     

     

     

    Billede

     

     

    </td>

     

     

     

    <td style="width: 100px">

     

     

     

    Filnavn

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </HeaderTemplate>

     

     

     

    <ItemTemplate>

     

     

     

    <table cellpadding="0" cellspacing="0" style="width: 190px;">

     

     

     

    <tr>

     

     

     

    <td style="width: 30px;">

     

     

     

    <%# Eval("IconID")%>

     

     

    </td>

     

     

     

    <td style="width: 60px;">

     

     

     

    <img src='<%= ImageController.Instance.ImagePathTreeViewRaw %><%# Eval("Icon")%>'

     

     

     

    alt="" width="16px" height="16px" />

     

     

     

    </td>

     

     

     

    <td style="width: 100px;">

     

     

     

    <%# Eval("Icon")%>

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </ItemTemplate>

     

     

     

    </telerik:RadComboBox>

     

     

     

    </td>

     

     

     

    </tr>

     

     

     

    </table>

     

     

     

    </EditItemTemplate>

     

     

     

    <ItemTemplate>

     

     

     

    <img src='<%= ImageController.Instance.ImagePathTreeViewRaw %><%# Eval("mapviewer_Icon.Icon")%>'

     

     

     

    alt="" width="16px" height="16px" />

     

     

     

    </ItemTemplate>

     

     

     

    </telerik:GridTemplateColumn>

     

     

     

    <telerik:GridCheckBoxColumn DataField="Enabled" DataType="System.Boolean" HeaderText="Aktiv"

     

     

     

    SortExpression="Enabled" UniqueName="Enabled">

     

     

     

    </telerik:GridCheckBoxColumn>

     

     

     

    <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Fjern" CommandName="Delete" />

     

     

     

    </Columns>

     

     

     

    <EditFormSettings>

     

     

     

    <EditColumn UniqueName="EditCommandColumn1">

     

     

     

    </EditColumn>

     

     

     

    </EditFormSettings>

     

     

     

    </MasterTableView>

     

     

     

    <ClientSettings>

     

     

     

    <Selecting AllowRowSelect="True" />

     

     

     

    </ClientSettings>

     

     

     

    </telerik:RadGrid>

     

     

     

     

     

    protected

     

    void RadGridContainers_ItemCommand(object source, GridCommandEventArgs e)

     

    {

     

    if (e.CommandName == RadGrid.InitInsertCommandName)

     

    {

    e.Canceled =

    true;

     

     

    System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary();

     

    layerDataClassesDataContext =

    new LayerDataClassesDataContext();

     

    newValues[

    "mapviewer_Container1.mapviewer_Icon.Icon"] = layerDataClassesDataContext.mapviewer_Icons.First(i => i.IconID.Equals(6));

     

    newValues[

    "mapviewer_Container1"] = layerDataClassesDataContext.mapviewer_Containers.First(c => c.ContainerIDParent.Equals(null));

     

    newValues[

    "mapviewer_Icon.Icon"] = layerDataClassesDataContext.mapviewer_Icons.First(i => i.IconID.Equals(6)).Icon;

     

    newValues[

    "mapviewer_Icon"] = layerDataClassesDataContext.mapviewer_Icons.First(i => i.IconID.Equals(6));

     

    e.Item.OwnerTableView.InsertItem(newValues);

     

     

     

    //layerDataClassesDataContext = new LayerDataClassesDataContext();

     

     

     

    //mapviewer_Container container = new mapviewer_Container();

     

     

     

    //container.mapviewer_Container1 = layerDataClassesDataContext.mapviewer_Containers.First(c => c.ContainerIDParent.Equals(null));

     

     

     

    //container.mapviewer_Icon = layerDataClassesDataContext.mapviewer_Icons.First(i => i.IconID.Equals(6));

     

     

     

    //e.Item.OwnerTableView.InsertItem(container);

     

     

     

    }

     

    }

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 22 Jul 2010 Link to this post

    Hi Jan,

    Could you please confirm that the grid editing works as expected?
    However I would suggest that you open a formal support ticket and send us a sample illustrating the error and our scenario. We could then debug it locally and find a suitable resolution for you.

    Best wishes,
    Iana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jan Pfeffer
    Jan Pfeffer avatar
    55 posts
    Member since:
    Aug 2006

    Posted 23 Jul 2010 Link to this post

    Hey Iana

    The editing of items in the grid works fine, it is problems with the GridInsertionObject only.

    Sincerly

    Jan
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 23 Jul 2010 Link to this post

    Hi Jan,

    In this case, it would be best if you can open a forma support ticket and send us a runnable sample of your scenario and the issue. Thus we will be able to debug it and find the cause of the issue and a resolution for it respectively.

    All the best,
    Iana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top