Solved

Build error with generated language resx files

Posted on 2008-10-16
5
788 Views
Last Modified: 2013-12-17
I generated resource files for usercontrols in a dedicated map. Now when I build, there is the 'object reference not set to an instance of an object' error that holds on a line with the meta:lblSomethingResource1.

When I remove that line, it shows the error for the next meta.

I tried with another web.config file that works for another site, but with no success.

the attached code is just an example of the first control. It happens with all controls.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucAnnounce.ascx.cs" Inherits="backoffice_userControls_ucAnnounce" %>

 

<asp:HyperLink ID="hlNew" runat="server" NavigateUrl="~/backoffice/EventAnounceEdit.aspx?filename=new&eventID=" Text="Nieuw bestand" meta:resourcekey="hlNewResource1" />

 

<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" Width="90%" AlternatingRowStyle-BackColor="#EEEEEE" meta:resourcekey="gvListResource1">

    <Columns>

        <asp:TemplateField meta:resourcekey="TemplateFieldResource1">

            <ItemTemplate>

                <asp:HyperLink ID="hlPage" runat="server" Target="_blank" Text='<%# MakeFullURL(Convert.ToString(Eval("Name"))) %>' NavigateUrl='<%# MakeFullURL(Convert.ToString(Eval("Name"))) %>' meta:resourcekey="hlPageResource1" />

            </ItemTemplate>

        </asp:TemplateField>

        <asp:TemplateField meta:resourcekey="TemplateFieldResource2">

            <ItemTemplate>

                <asp:Label ID="lblName" runat="server" Visible="False" Text='<%# Eval("Name") %>' meta:resourcekey="lblNameResource1" />

                <asp:ImageButton ID="lbEdit" runat="server" ImageUrl="~/backoffice/images/icon_edit.gif" OnClick="lbEdit_Click" meta:resourcekey="lbEditResource1" />&nbsp;

                <asp:ImageButton ID="lbDelete" runat="server" ImageUrl="~/backoffice/images/icon_close.gif" OnClick="lbDelete_Click" meta:resourcekey="lbDeleteResource1" />

            </ItemTemplate>

            <ItemStyle HorizontalAlign="Right" />

        </asp:TemplateField>

    </Columns>

    <AlternatingRowStyle BackColor="#EEEEEE" />

</asp:GridView>

<asp:Label ID="lblEmpty" runat="server" Text="<br />U hebt momenteel geen announce pagina's<br />" Visible="False" meta:resourcekey="lblEmptyResource1" />

<br />

<asp:HyperLink ID="hlNew2" runat="server" NavigateUrl="~/backoffice/EventAnounceEdit.aspx?filename=new&eventID=" Text="Nieuw bestand" meta:resourcekey="hlNew2Resource1" />

Open in new window

0
Comment
Question by:corcon
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22738294
from which resource file you are getting this key meta:lblSomethingResource1

refre this for details
http://www.codeproject.com/Kb/aspnet/localizationByVivekTakur.aspx
0
 

Author Comment

by:corcon
ID: 22738507
I'm sorry, bad example, of course it must be like this: meta:resourcekey="hlNewResource1" (like in the example)

This is generated by Tools > Generate local resources

So it is the corresponding file in the App_LocalResources directory with filename ucAnnounce.ascx.resx

I did this a million times, but this is the first time it won't build because of this error.
0
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 500 total points
ID: 22738609
You are probably calling Localization from somewhere in your code. If you are doing that, it's going to need the file and strings mapped to the ones that are being localized.
0
 

Author Comment

by:corcon
ID: 22738786
Yes, in the main site (1 directory up), there is indeed other localization code.

Damn, didn't see that one.

Can I use a different web.config for the underlying path or isn't there a way around to use that one to?
0
 

Author Closing Comment

by:corcon
ID: 31506697
Tnx to point me out on this, but it would be nice if I knew how to solve this without using the used translationtool.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now