More in this section

Forums / General Discussions / How to Handle Resource Key Exception

How to Handle Resource Key Exception

2 posts, 0 answered
  1. Moiz Ahmed
    Moiz Ahmed avatar
    15 posts
    31 Dec 2010
    08 Mar 2011
    Link to this post
    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
  2. Slavo
    Slavo avatar
    295 posts
    24 Sep 2012
    14 Mar 2011
    Link to this post
    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,
    the Telerik team
2 posts, 0 answered