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

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

17 Answers 769 Views
Grid
This is a migrated thread and some comments may be shown as answers.
أشرف
Top achievements
Rank 1
أشرف asked on 28 Nov 2013, 09:28 AM
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.

17 Answers, 1 is accepted

Sort by
0
أشرف
Top achievements
Rank 1
answered on 28 Nov 2013, 10:21 AM
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.
0
Eirik H
Top achievements
Rank 2
answered on 12 Mar 2015, 11:50 AM
I'm also struggling to get a RadComboBox to work inside a GridTemplateColumn EditTemplate if the grid edit mode is Batch. Any suggestions, Telerik?
0
Eirik H
Top achievements
Rank 2
answered on 12 Mar 2015, 12:28 PM
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 ..
0
John
Top achievements
Rank 1
answered on 07 Apr 2015, 08:28 PM
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.
0
John
Top achievements
Rank 1
answered on 07 Apr 2015, 09:54 PM

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

 

0
John
Top achievements
Rank 1
answered on 07 Apr 2015, 10:23 PM
Sorry, strike my last post.  It is not "*** Solved ***".  My earlier post was mistakenly posted regarding another issue.
0
Konstantin Dikov
Telerik team
answered on 10 Apr 2015, 12:59 PM
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.

 
0
Eirik H
Top achievements
Rank 2
answered on 15 Apr 2015, 10:06 AM

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

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

0
Konstantin Dikov
Telerik team
answered on 15 Apr 2015, 10:24 AM
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.

 
0
John
Top achievements
Rank 1
answered on 15 Apr 2015, 04:56 PM

*** 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.

0
Windhoek2010
Top achievements
Rank 1
answered on 10 May 2016, 10:32 AM

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?

0
Konstantin Dikov
Telerik team
answered on 13 May 2016, 07:06 AM
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.
0
Adam
Top achievements
Rank 1
answered on 16 May 2016, 07:45 PM
I am having this exact issue, but with a RadDropDownList, it currently refuses to actually assign the selectedvalue of the raddropdownlist to the GridTemplateColumn. 
0
Konstantin Dikov
Telerik team
answered on 19 May 2016, 03:29 PM
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.
0
Adam
Top achievements
Rank 1
answered on 20 May 2016, 08:04 PM

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.

0
Konstantin Dikov
Telerik team
answered on 25 May 2016, 01:39 PM
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.
0
Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 12 Nov 2018, 06:52 AM
how to change radgridview column header color ?
Tags
Grid
Asked by
أشرف
Top achievements
Rank 1
Answers by
أشرف
Top achievements
Rank 1
Eirik H
Top achievements
Rank 2
John
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Windhoek2010
Top achievements
Rank 1
Adam
Top achievements
Rank 1
Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or