After insert a row I got this message : Refresh cannot execute when CanLoad is false. Refreshing the data initiates a load operation, and load.
And it's possible to use Resource to change the language for the text "Click here to add new item"?
Any Idea? Thank you
8 Answers, 1 is accepted
The problem you have encountered - "Refresh cannot execute when CanLoad is false" is already a known issue and we are working on solving it. The fix will be available in our next latest internal build.
There is a possible workaround in order to remove the exception thrown when an item is added in that way. What you need to do is to handle the DataError event.
However, if it is not too urgent for your project, I would recommend you to download the upcoming latest internal build.
As for the possibility of changing the language for the specified text, you need to create Custom Localization Manager:
public class CustomLocalizationManager : LocalizationManager
{
public override string GetStringOverride( string key )
{
switch( key )
{
case "GridViewAlwaysVisibleNewRow":
return "New Insert Text"
}
return base.GetStringOverride( key );
}
}
public partial class App : Application
{
public App()
{
LocalizationManager.Manager = new CustomLocalizationManager();
}
}
You may find more information about the localization mechanism in our online documentation.
We will add translation for the ShowInsertRow element in German and Spanish in our latest internal build.
All the best,
Maya
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.
By the way, can you provide me an example for the throw? I try something like this but without success :
private void MyDataGrid_DataError(object sender, Telerik.Windows.Controls.GridView.DataErrorEventArgs e)
{
throw (e.Exception);
e.Handled =
true;
}
You can handle the DataError event in different ways depending on what you want to achieve. For example you may handle it in the following way:
void artistGridView_DataError(object sender, DataErrorEventArgs e)
{
if (e.Exception is InvalidOperationException && e.Exception.Message.Contains("CanLoad"))
{
e.Handled = true;
this.artistDomainDataSource.SubmitChanges();
this.artistGridView.Rebind();
}
}
However, you need to define the event beforehand:
this.artistGridView.DataError +=
new System.Windows.Forms.GridViewDataErrorEventHandler(
this.productsGridView_DataError);
The line: this.artistDomainDataSource.SubmitChanges(); is the custom logic and you may change it in the way you need.
Regards,
Maya
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.
BTY, my GridView is not refreshed with this line : this.artistGridView.Rebind();
And, do you think it's possible to use Resource (resx files) rather the GetStringOverride?
The problem with ShowInsertRow is already fixed in our latest internal build. So, if you download it from your account, you will not need to use the workaround with handling DataError event.
As for the second question, you can avoid using the method GetStringOverride(), but you have to edit the resources we provide in the way you want them and then to use the LocalizationManager as if you create Custom Resources. You can find detailed information on how to do that in our online documentation.
Maya
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.
I have this built on my mahcine : RadControls for Silverlight Trial Version: 2010.1 422 (Apr 22, 2010)
It's the built you talk about it or a new one?
Regards
The version you have is our official release Q1 2010. However, you are able to download our latest internal build - from 15.05.2010.
You will find it in Your Account -> Downloads -> RadControls for Silverlight -> Latest Internal Build.
Maya
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.