Solved

Build error with generated language resx files

Posted on 2008-10-16
5
803 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

705 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