Localized error meassages (Chapter 22) - Client can not find resource!


 good morning

i have  integrated step step chapter 22 "how dispaly localized error messages" in silverlight application. have problem, when client throws validation exception dont the errormessage exception "the object instance not found" (in red comment panel).

i set propertiy "build action" of resource file on server side "embedded resource" , link file in client side.

i have set namespace of resource file on server side structure folder link (client side) located. can here wrong? 

is there didn't attend? whats experience in localization of error messages?

 

thank u

22         how display localized error messages

this section explores how error messages can localized storing them in resource files , sharing them across tiers.

22.1        sample setup

the example code in document uses .net ria services walkthrough project base project , builds on top of it. start working on example, open walkthrough project.

22.2       creating error messages resource file

let's want add validation error resource loginid field.

-          create new ‘resources' folder in hrapp.web project (server project)

-          add new resource file folder , name validationerrorresources.resx

-          double click on .resx file bring resource  designer  page

-          add new string resource name= loginidvalidationerror , value= "loginid field required"

-          change access modifier ‘public' clicking on ‘access modifier' drop down ui , selecting ‘public' , save project. generates validationerrorresources class in hrapp.web.resources namespace.

-          open ‘organizationservice.metadata.cs' file , add following ‘required' field validation loginid member. specify error message resource name , resource type values setting corresponding attribute members shown below.

 

[required(errormessageresourcename = "loginidvalidationerror", errormessageresourcetype = typeof(validationerrorresources))]                      

public string loginid;

 

now want share resource file in silverlight project (client project). this,

-          create folder web\resources in hrapp project (folder structure must match resource file namespace on server side)

-          select resources folder , bring add existing file dialog, browse server side resource file folder location

-          select validationerrorresources.resx , validationerrorresources.designer.cs files, , add them link files silverlight project. save project file

-          open hrapp.csproj file in notepad , locate section .designer.cs file included , add highlighted 3 lines section

 

 

  <compile include="..\hrapp.web\resources\validationerrorresources.designer.cs">

    <autogen>true</autogen>

    <designtime>true</designtime>

    <dependentupon>validationerrorresources.resx</dependentupon>

    <link>web\resources\validationerrorresources.designer.cs</link>  </compile>

 

-          save project file , reload project in visual studio

-          build solution , run

 

now whenever validation fails loginid field error message resource file shown user. resource file can customized store locale specific error messages.



Silverlight  >  WCF RIA Services with Silverlight



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........