How to Handle Resource Key Exception

Posted by Community Admin on 03-Aug-2018 13:39

How to Handle Resource Key Exception

All Replies

Posted by Community Admin on 08-Mar-2011 00:00

Could not find the specified key "Resource_Key1" or class id "Resource_Class"

<h6> <%=GetGlobalResourceObject("Resource_Class", "Resource_Key1")%> </h6>

Is there any way I can handle this Exception and know that the key is unavailable. besides using try catch in my control

Posted by Community Admin on 14-Mar-2011 00:00

Hello Moiz Ahmed,

There's no way to handle the exception if you're declaring the resource in the control template. However, you can do it through code.

You can manually retrieve the value of a resource using the Res class's Get method. There are many overloads of this method, and one of them accepts a boolean argument which indicates whether an exception should be thrown or not.

You can find the API reference for this method here.

All the best,
Slavo
the Telerik team

This thread is closed