Unable to cast object of type 'PanelNamingContainer' to type 'Telerik.Web.UI.GridItem'

18 posts, 0 answers
  1. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 28 Nov 2013 Link to this post

    I get this error when I place a RadComboBox inside the edit and insert templates of a template column, with its selected value bound declaratively like this:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" DataTextField="Store_Desc" DataValueField="Store_Code" CollapseDelay="200" DataSourceID="storesDataSource" SelectedValue='<%# Bind("Store_Code") %>'>
    </telerik:RadComboBox>
    How to resolve this in any way other than setting the item manually in the item data bound event.
  2. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 28 Nov 2013 Link to this post

    Aside from the exception which seems to occur because some controls wasn't ready for batch mode, data binding is not needed in batch mode because values are set on the client side.

    Sorry for my misunderstanding.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Prasanna
    Prasanna avatar
    47 posts
    Member since:
    Oct 2012

    Posted 04 Dec 2014 Link to this post

    Hello Ashraf Sabry,

     Then how to bind the radcombobox i dont know how to do this. Please help me on that    
  5. Eirik H
    Eirik H avatar
    36 posts
    Member since:
    Mar 2010

    Posted 12 Mar 2015 in reply to Ashraf Sabry Link to this post

    I'm also struggling to get a RadComboBox to work inside a GridTemplateColumn EditTemplate if the grid edit mode is Batch. Any suggestions, Telerik?
  6. Eirik H
    Eirik H avatar
    36 posts
    Member since:
    Mar 2010

    Posted 12 Mar 2015 in reply to Eirik H Link to this post

    I take that back .. for some unknown magical reason it all works with selectedvalue, add, update and everything if you just place a radcomboxinside there ..
  7. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 07 Apr 2015 Link to this post

    Telerik, could you respond in detail to the above?  I'm having the same issue ...RadComboBox inside of a GridTemplate in the RadGrid MasterView while in Batch edit mode.
  8. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 07 Apr 2015 Link to this post

    *** Solved ***  I moved the following from the main RadGrid declaration its MasterTableView declaration ...                    AllowAutomaticUpdates="true"
    AllowAutomaticInserts="true"
    AllowAutomaticDeletes="true"

     

  9. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 07 Apr 2015 Link to this post

    Sorry, strike my last post.  It is not "*** Solved ***".  My earlier post was mistakenly posted regarding another issue.
  10. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 10 Apr 2015 Link to this post

    Hi John,

    I have noticed that you have opened a regular support ticket (Ticket ID: 924035) for the same issue, so I could suggest that you refer to the answer in it.

    If any further questions arise on this matter, I could suggest that we continue the conversation in the support ticket.


    Best Regards,
    Konstantin Dikov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  11. Eirik H
    Eirik H avatar
    36 posts
    Member since:
    Mar 2010

    Posted 15 Apr 2015 in reply to Konstantin Dikov Link to this post

    Konstantin Dikov said:
    If any further questions arise on this matter, I could suggest that we continue the conversation in the support ticket. 

    Yeah. what a great idea to not share the solution with your other customers

  12. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 15 Apr 2015 Link to this post

    Hi Eirik,

    The cause of the problem is explained by Ashraf in his second post. The same information is also available in our help article "RadGrid - Batch Editing": "When the EditMode is set to Batch, data binding expressions are not allowed in the EditItemTemplate. RadGrid will automatically set the editor's value."

    Notwithstanding, it was mistake on my end to not provide detailed information in my previous reply.


    Regards,
    Konstantin Dikov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  13. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 15 Apr 2015 Link to this post

    *** Solved ***   Apparently, binding doesn't get along and play well with Batch Mode.  So, I removed any binding from the EditItemTemplate when in Batch Mode.   

    As a side note, I do agree with Eirik, where, I wish Support would give complete answers in the forum, and not refer you back to the a support ticket.  The forum would be much better if Support would be more responsive, with both timeliness and substance.  On some threads, they don't reply at all.

    For everyone's benefit, here's the reply from Support ...

    After examining the setup I have to say that the described behavior is expected. Now the Batch edit mode unlike the others is client oriented, meaning that it will set the selected value of the combo on the client. This is done by our internal logic and there is no need add a bind expression to accomplish that. Moreover using binding expressions may cause problems like the described and should be avoided as noted in this help article - "When the EditMode is set to Batch data binding expressions are not allowed in the EditItemTemplate. RadGrid will automatically set the editor's value. "

    Considering the aforementioned I recommend removing the bind/eval expressions from the EditItemTemplate and letting our internal logic get/set the editor value. Please examine the information provided and let us know if additional assistance is required.

  14. Windhoek2010
    Windhoek2010 avatar
    14 posts
    Member since:
    Jul 2014

    Posted 10 May in reply to John Link to this post

    Thanks for posting Support's answer. I noted: "When the EditMode is set to Batch data binding expressions are not allowed in the EditItemTemplate. RadGrid will automatically set the editor's value"

    How did you get the selected value in the RadComboBox to "bind" without SelectedValue='<%# Bind("Store_Code") %>'? What does "RadGrid will automatically set the editor's value" mean?

  15. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 13 May Link to this post

    Hi,

    The internal logic of the Batch Editing manager will retrieve the value from the cell and will try to set it to the editor in the EditItemTemplate (if the editor is supported).  Since each column will generate only one editor and will move it along the edited cells, setting the SelectedValue is not applicable, because there will be only one editor. 

    You could refer to our online documentation for more information about Batch editing:

    Best Regards,
    Konstantin Dikov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  16. Adam
    Adam avatar
    11 posts
    Member since:
    Jun 2015

    Posted 16 May in reply to Konstantin Dikov Link to this post

    I am having this exact issue, but with a RadDropDownList, it currently refuses to actually assign the selectedvalue of the raddropdownlist to the GridTemplateColumn. 
  17. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 19 May Link to this post

    Hi Adam,

    Can you please elaborate on your exact configuration of the GridTemplateColumn? If you are trying to select the value through the SelectedValue of the RadDropDownList, as discussed in previous posts, this is not supported and the value will be retrieved from the cell.


    Regards,
    Konstantin Dikov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  18. Adam
    Adam avatar
    11 posts
    Member since:
    Jun 2015

    Posted 20 May in reply to Konstantin Dikov Link to this post

    No, I am trying to get the value of the column, from the newvalues data that is passed through from the batchedit command, for the example in my previous post: http://www.telerik.com/forums/batchedit-command-event-does-not-contain-newvalues-for-raddropdownlist 

    The issue is that, no matter what I seem to do, the actual value itself is never being passed back through the newvalues data, when using the raddropdownlist, but when I change this to an asp:dropdownlist, the value is passed perfectly fine, but in that case the selected text is not correctly displayed in the column(it shows the value of the dropdownlist, rather than the text, when not in edit mode.

  19. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 25 May Link to this post

    Hello Adam,

    Please take a look at the following online demo and especially the "Category" template column, where RadDropDownList control is used in the EditItemTemplate:
    If you are using an older version of the controls, please try to upgrade to the latest version and see if the issue on your side will persist.


    Regards,
    Konstantin Dikov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017