#1: How to add localized listitems to a dropdownlist ?
Posted on 2008-04-24 22:37:20 by Radu
For stuff like
<asp:CustomValidator
id="validDate"
Text="*"
ErrorMessage= "<%$ Resources:Scorecards, String66 %>"
Display="Dynamic"
OnServerValidate="ServerValidate"
runat="server">
</asp:CustomValidator>
apparently the syntax
....= "<%$ Resources:Scorecards, String66 %>"
works, but in the HTML
<asp:DropDownList
ID="cboEPSSessions"
runat="server"
ToolTip="<%$ Resources:Scorecards, String68 %>"
>
<asp:ListItem><%$ Resources:Scorecards, String103%></
asp:ListItem>
<asp:ListItem><%$ Resources:Scorecards, String104%></
asp:ListItem>
<asp:ListItem><%$ Resources:Scorecards, String105%></
asp:ListItem>
</asp:DropDownList>
my syntax doesn't work anymore at all.
I have the error:
Literal expressions like '<%$ Resources:Scorecards, String103%>' are
not allowed.
Use <asp:Literal runat="server" Text="<%$ Resources:Scorecards,
String103%>" /> instead.
But if I use the suggested
<asp:ListItem>
<asp:Literal runat="server" Text="<%$ Resources:Scorecards,
String63%>" />
</asp:ListItem>
instead, I get the error
Element 'Literal' is not a known element. This can occur if there is a
compilation error in the Web site.
So then, my question is: How to add localized listitems to a
dropdownlist ?
Thank you.
Alex
Report this message |
#2: Re: How to add localized listitems to a dropdownlist ?
Posted on 2008-04-24 22:48:12 by Radu
As another user said in some thread, the best way to solve a problem
is to post the question here - you don't event need to have it
answered - the moment you hit the "post" button, you realize how
simple the answer was, and how blind you have been.
In other words, it's as simple as:
<asp:ListItem Text=3D"<%$ Resources:Scorecards, String103%>"></
asp:ListItem>
or
<option selected=3D"selected" value=3D"<%$ Resources:Scorecards,
String79%>"></option>
instead of
<asp:ListItem><%$ Resources:Scorecards, String103%></asp:ListItem>
or
<option selected=3D"selected"><%$ Resources:Scorecards, String79%></
option>
I am sorry for not having an option to withdraw a question.
Thanks again.
On Apr 24, 4:37=A0pm, Radu <cuca_macaii2...@yahoo.com> wrote:
> For stuff like
> <asp:CustomValidator
> =A0 =A0 =A0 =A0 id=3D"validDate"
> =A0 =A0 =A0 =A0 Text=3D"*"
> =A0 =A0 =A0 =A0 ErrorMessage=3D "<%$ Resources:Scorecards, String66 %>"
> =A0 =A0 =A0 =A0 Display=3D"Dynamic"
> =A0 =A0 =A0 =A0 OnServerValidate=3D"ServerValidate"
> =A0 =A0 =A0 =A0 runat=3D"server">
> </asp:CustomValidator>
> apparently the syntax
> ...=3D "<%$ Resources:Scorecards, String66 %>"
> works, but in the HTML
> <asp:DropDownList
> =A0 =A0 =A0 =A0 ID=3D"cboEPSSessions"
>
> runat=3D"server"
> =A0 =A0 =A0 =A0 ToolTip=3D"<%$ Resources:Scorecards, String68 %>"
> =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 <asp:ListItem><%$ Resources:Scorecards, String103%></
> asp:ListItem>
> =A0 =A0 =A0 =A0 <asp:ListItem><%$ Resources:Scorecards, String104%></
> asp:ListItem>
> =A0 =A0 =A0 =A0 <asp:ListItem><%$ Resources:Scorecards, String105%></
> asp:ListItem>
> </asp:DropDownList>
> my syntax doesn't work anymore at all.
>
> I have the error:
> Literal expressions like '<%$ Resources:Scorecards, String103%>' are
> not allowed.
> Use <asp:Literal runat=3D"server" Text=3D"<%$ Resources:Scorecards,
> String103%>" /> instead.
>
> But if I use the suggested
> <asp:ListItem>
> =A0 =A0 =A0 =A0 <asp:Literal runat=3D"server" Text=3D"<%$ Resources:Scorec=
ards,
> String63%>" />
> </asp:ListItem>
> instead, I get the error
> Element 'Literal' is not a known element. This can occur if there is a
> compilation error in the Web site.
>
> So then, my question is: How to add localized listitems to a
> dropdownlist ?
>
> Thank you.
> Alex
Report this message |