Solved

Build error with generated language resx files

Posted on 2008-10-16
5
798 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

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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