ASP.NET 2.0 Localisation problem Localizable attribute not working...

A

aidancasey

I have written a custom control called CheckboxDataList that derives
from the DataList webControl.

My control contains a public property called CheckedValues. The type of
this property is a generic <List> of strings


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace BFarm.WebControls
{
public class BfarmCheckboxDataList : DataList
{
public List<string> CheckedValues
{
//
//
}
}

My control is defined as follows on my webform

<%@ Register Assembly="ControlLibrary" Namespace="ControlLibrary"
TagPrefix="cc1" %>

<form id="form1" runat="server">
<cc1:CheckboxDataList ID="BfarmCheckboxDataList1"
runat="server" RepeatColumns="14"
RepeatDirection="Horizontal" RepeatLayout="Table">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat='server' />
&nbsp;
<asp:Label ID="Label1" runat='server'
Visible="false"></asp:Label>
</ItemTemplate>
</cc1:BCheckboxDataList>
</form>

I am using the designed to generate the local resource files fro my web
form ( in design view navigate to Tools and click on Generate Local
Resources).

The IDE seems to think that the property of my control CheckedValues
should be localised and it adds the following code to my webform
CheckedValues="(Collection)"


<cc1:BfarmCheckboxDataList ID="CheckboxDataList1" runat="server"
RepeatColumns="14"
RepeatDirection="Horizontal" CheckedValues="(Collection)"
meta:resourcekey="BfarmCheckboxDataList1Resource2" ReadOnly="False">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat='server'
meta:resourcekey="CheckBox1Resource2" />
&nbsp;
<asp:Label ID="Label1" runat='server' Visible="False"
meta:resourcekey="Label1Resource2"></asp:Label>
</ItemTemplate>
</cc1:CheckboxDataList>

How can I prevent the ide from generating this code and how can I tell
the IDE not to treat this property as something that should be
localised?

I have tried decorating the property with the following attribute
[Localizable(false)]
But it does nothing

Help !!!
 
G

Gawel

Just decorate your property with following attributes:

[DefaultValue((string)null),
PersistenceMode(PersistenceMode.InnerDefaultProperty)]

Yes I know it's strange but it works.

Pawel Pabich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top