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

ShowInsertRow and Refresh cannot execute when CanLoad is false

8 Answers 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Louis Bouchard
Top achievements
Rank 1
Louis Bouchard asked on 10 May 2010, 03:42 AM
I use riaControls:DomainDataSource and telerik:RadGridView with the ShowInsertRow to true.

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

Sort by
0
Maya
Telerik team
answered on 12 May 2010, 02:14 PM
Hi Louis Bouchard,

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.
0
Louis Bouchard
Top achievements
Rank 1
answered on 12 May 2010, 03:59 PM
THank a lot for your time Maya.

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;

 

}

0
Maya
Telerik team
answered on 12 May 2010, 05:52 PM
Hi Louis Bouchard,

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.
0
Louis Bouchard
Top achievements
Rank 1
answered on 16 May 2010, 03:32 PM
Thank a lot for your time Maya.  Fast answer!!

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?
0
Maya
Telerik team
answered on 17 May 2010, 10:10 AM
Hello Louis Bouchard,

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.


Best wishes,
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.
0
Louis Bouchard
Top achievements
Rank 1
answered on 17 May 2010, 02:41 PM
Nice Maya,

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
0
Maya
Telerik team
answered on 17 May 2010, 04:31 PM
Hi Louis Bouchard,

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. 

 

Sincerely yours,
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.
0
Louis Bouchard
Top achievements
Rank 1
answered on 17 May 2010, 04:41 PM
Very nice service.  Thank you a lot Maya!
Tags
GridView
Asked by
Louis Bouchard
Top achievements
Rank 1
Answers by
Maya
Telerik team
Louis Bouchard
Top achievements
Rank 1
Share this question
or