Error on insert

9 posts, 0 answers
  1. Neil
    Neil avatar
    16 posts
    Member since:
    Mar 2007

    Posted 19 Mar 2008 Link to this post

    I'm using a Prometheus RadGrid that's bound to an IList, and I'm having some trouble with inserts. When I click the Add button, I get an exception:

    DataBinding: 'Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'PhoneType'.

    The error occurs as soon as I press the Add button, before the table shows any insertion controls. As far as I know, I'm not missing any relevant events, but I can't seem to figure out what I'm doing wrong. My table is declared like this:

        <telerik:RadGrid runat="server" ID="phoneGrid" AutoGenerateColumns="false" > 
            <MasterTableView CommandItemDisplay="Bottom"
                <Columns> 
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" /> 
                    <telerik:GridBoundColumn DataField="ContactPhoneid" Visible="false" ReadOnly="true" /> 
                    <telerik:GridDropDownColumn DataField="PhoneType.PhoneTypeName" HeaderText="Type" ListTextField="PhoneTypeName" ListValueField="PhoneTypeid" DataSourceID="phoneTypeSource" /> 
                    <telerik:GridBoundColumn DataField="Phone.PhoneNumber" HeaderText="Phone Number" MaxLength="50" /> 
                    <telerik:GridBoundColumn DataField="Phone.PhoneExtension" HeaderText="Extension" MaxLength="10" /> 
                    <telerik:GridBoundColumn DataField="Phone.PhoneDesc" HeaderText="Description" MaxLength="50" /> 
                    <telerik:GridButtonColumn ButtonType="LinkButton" Text="Delete" CommandName="Delete" ConfirmText="Are you sure you want to delete this entry?" /> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 

    I'm catching NeedDataSource, ItemCommand, and ItemInserted. Am I missing something, or is there a bug with object binding and subobjects?
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 20 Mar 2008 Link to this post

    Hello Ralph,

    Unfortunately, this scenario is not supported for GridDropDownColumn. The workaround is to use GridTemplateColumn with a DropDownList in EditItemTemplate.

    Please, accept our apologies for the inconvenience caused.


    Kind regards,
    Ves
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. dstj
    dstj avatar
    82 posts
    Member since:
    Oct 2006

    Posted 12 May 2008 Link to this post

    Hi Ves,

    I too am facing the same problem as Ralph.You mention that this scenario is not supported for GridDropDownColumn. Is is not supported "for the moment" and will be in future releases or is it not supported period?

    Thanks for the information,

    Dominic.
  5. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 15 May 2008 Link to this post

    Hi Dominic,

    I'm happy to inform you that our developers have addressed this request. Therefore the fix will be available in the next service pack which is expected to be released by the end of the week.

    Best wishes,
    Rosen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Dwayne
    Dwayne avatar
    41 posts
    Member since:
    Jun 2009

    Posted 28 Jul 2009 Link to this post

    I am still having this issue I noticed that on my insertion when my result set comes back as null this happens if there is a fix out there where can i find it. Thanks
  7. Dwayne
    Dwayne avatar
    41 posts
    Member since:
    Jun 2009

    Posted 28 Jul 2009 Link to this post

    I don't know if it matters but i am using a grid as a user control and the edit form is also a user control and when i have a empty dataset the insert blows up  and this is the same with all insert that are created in this fashion
  8. BaiH
    BaiH avatar
    83 posts
    Member since:
    Aug 2008

    Posted 31 Jul 2009 Link to this post

    Let me guess, you are using a collection of custom object, maybe with nested sub objects? In such case you should do something like this:

    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
       if (e.CommandName == RadGrid.InitInsertCommandName) 
       { 
           e.Canceled = true
           e.Item.OwnerTableView.InsertItem(new MyCustomEntity()); 
       } 

    This will pass a instance of your custom object to grid's insert form ensuring that all fields are there.

    --BH


  9. FreshOne
    FreshOne avatar
    22 posts
    Member since:
    Jan 2010

    Posted 08 Mar 2010 Link to this post

    hi BaiH,
    ur solution works perfectly excepts when the object includes a foreign key, i get this error:
    Sys.WebForms.PageRequestManagerServerErrorException: Selection out of range
    Parameter name: value

    here is my code
            If e.CommandName = RadGrid.InitInsertCommandName Then 
                e.Canceled = True 
                e.Item.OwnerTableView.InsertItem(New City())  
            End If 

    object city includes countryID as a foreign key

    any ideas?
    thnx in advance
  10. Ramya
    Ramya avatar
    2 posts
    Member since:
    Jul 2012

    Posted 14 Nov 2013 Link to this post

    BH - you saved my day. I am using nested objects and it worked. Thank you!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017