We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Unable to cast object of type ''System.Windows.Forms.Panel'' to type ''Syncfusion.Windows.Forms.Grid.GridControl''.

Thread ID:

Created:

Updated:

Platform:

Replies:

98284 Feb 17,2011 04:48 PM UTC Feb 25,2011 07:11 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: Tools
Administrator [Syncfusion]
Asked On February 17, 2011 04:48 PM UTC

Recently we upgraded from v3.3 to v8.4 the following line of code used to work but now has a casting error.

((Syncfusion.Windows.Forms.Grid.GridControl)this.Calendar.Controls[0]).WantTabKey = false;

The calendar is a DateTimePickerADV.MonthCalendarForDateTimePickerAdv

Has something changed that you are no longer able to make this cast and if so is there some equivalent syntax that can accomplish using the WantTabKey properity?
Also this error only happens with I open the form in designer mode


Mahendran [Syncfusion]
Replied On February 25, 2011 07:11 AM UTC

Hi Samantha ,

Thanks for your interest in Syncfusion Products.

To avoid this casting error you have to remove the below code from FormDesigner code and have to use in Form Load event. This is because the value of Controls[0] is cannot be recognized in designer mode. This works fine after initialization is done. The following code explains the same.

Code snippet [C #]

private void Form1_Load(object sender, EventArgs e)
{
if ((Syncfusion.Windows.Forms.Grid.GridControl)this.monthCalendarAdv1.Controls[0] is GridControl )
((Syncfusion.Windows.Forms.Grid.GridControl)this.monthCalendarAdv1.Controls[0]).WantTabKey = false;
}


Please let us know if you have any concerns.

Regards,
R.Mahendran



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;