473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to add localized listitems to a dropdownlist ?

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
Jun 27 '08 #1
1 6738
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="<%$ Resources:Scorecards, String103%>"></
asp:ListItem>

or

<option selected="selected" value="<%$ Resources:Scorecards,
String79%>"></option>

instead of

<asp:ListItem><%$ Resources:Scorecards, String103%></asp:ListItem>

or

<option selected="selected"><%$ Resources:Scorecards, String79%></
option>

I am sorry for not having an option to withdraw a question.

Thanks again.

On Apr 24, 4:37*pm, Radu <cuca_macaii2...@yahoo.comwrote:
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
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: charliewest | last post by:
I have binded a dropdownlist control to a data view. I am trying to add a listitem to this already binded control, however, i cannot figure this out. My code is: // code to create data view...
7
by: Doug | last post by:
I want to display a drop-down list (System.Web.UI.WebControls.DropDownList) loaded with font names the user can select (Verdana, Garamond, etc)... got this far no problem. Now I'd like to have...
1
by: Jeff | last post by:
Hi - I'm creating a web control library (using VB.NET), and I'm trying to add a modified asp:dropdownlist control to it. How do I add asp:ListItems to the dropdownlist (within the web control...
1
by: HoustonFreeways | last post by:
I am populating a dropdownlist via a databind to a database. However, the text to be displayed can be very long, making the dropdownlist very wide. I need some way to reduce the width of the...
3
by: Mark Findlay | last post by:
When programming reads of the Windows Registry, do the registry keys and values need to be localized for international use? For example, do I need to convert the key name...
2
by: Arthur Dent | last post by:
Hi all, I have a control which i wrote which inherits the asp:dropdownlist control. Works great, all happy. If when using it i try to declaratively add some items, it complains that they are...
8
by: sudhaMurugesan | last post by:
Hi, Can anyone Help. I have two dropdownlist for qualification and degree. According to the qualification(eg.Diploma,UG,PG) degree gets binded in the dropdownlist. I have done this in...
25
by: sudhaMurugesan | last post by:
Hi ALL, I am binding ListItems to dropdownlist using js.But the selected value is not retained while save operation. Do I need to capture the selected Item in any hiddenfields ? plz tell me ...
0
by: Radu | last post by:
I have a global resource, Scorecards.resx. For stuff like <asp:CustomValidator id="validDate" Text="*" ErrorMessage= "<%$ Resources:Scorecards, String66 %>" Display="Dynamic"...
1
by: Nathan Sokalski | last post by:
I am creating a control in which I inherit from the DropDownList. The only method that I override is RenderContents. Here is my basic code: Public Class StatesDropDownList : Inherits DropDownList...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.