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

User function does not return the correct value

0 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Viviane
Top achievements
Rank 1
Viviane asked on 06 Jan 2011, 08:14 PM
Hello,

I am using Telerik Reporting Q3 2009 and I have a user function defined.

When I use it inside my code it works fine but when I call it from the report it does not return the expected value.
Here is the code in VB.Net:

GetResourceValue("Txt:Days", "CoreFunctions")

which returns : Days

Inside the report in a table field I use the following expression:

=TelerikReports.modCommon.GetResourceValue("Txt:Days", "CoreFunctions")

which returns" Txt:Days"

Here is my function:

 

  Public Function GetResourceValue(ByVal sKey As String, ByVal sAppName As String) As String
        Try
            Dim ds As New DataSet
            ds.ReadXml(System.Web.HttpContext.Current.Server.MapPath(".") & "\..\ResourceFiles\" & sAppName & "." & LANGUAGE & ".resx")
            Dim rows() As DataRow = ds.Tables("data").Select("name = '" & sKey & "'")
            If rows.Length > 0 Then
                Return rows(0)("value")
            Else
                Return sKey
            End If
        Catch ex As Exception
            Return sKey
        End Try
    End Function

 

Any idea ?

Thanks in advance

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Viviane
Top achievements
Rank 1
Share this question
or