I am try to set the text of the drop down list item as
ListItem li = new ListItem();
li.Text = " "+"MyVal ue";
myDropDown.Item s.Add("li);
The intent is to add a spacing in front of the text. Its not doing what I am
trying to do. The text shows up as "&MyValu e"
How can this be accomplished? 5 11152
Thanks Justin,
I tried that. It truncates the blank spaces at the start. In regular ASP
apps I was able to do..
<option> & nbsp;MyValue
I am trying to do the same thing with DropdownList control
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:um******** ******@tk2msftn gp13.phx.gbl... Naveen,
Drop down lists don't use the same encoding as regular html on the page.
Just add a regular " " space.
Sincerely,
-- S. Justin Gengo, MCP Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order." Nietzche
"Naveen K Kohli" <na*********@ho tmail.com> wrote in message news:ON******** ******@TK2MSFTN GP12.phx.gbl... I am try to set the text of the drop down list item as
ListItem li = new ListItem(); li.Text = " "+"MyVal ue";
myDropDown.Item s.Add("li);
The intent is to add a spacing in front of the text. Its not doing what
I am trying to do. The text shows up as "&MyValu e"
How can this be accomplished?
What I think the issue is is that you are using the "+" to
add both strings..i think you must use the & char.
Well in VB.Net in C# your right on the money I think..you
use the "+"..but you didn't specify any language
ListItem li = new ListItem();
li.Text = " " & "MyValue";
myDropDown.Item s.Add("li"); -----Original Message----- Thanks Justin, I tried that. It truncates the blank spaces at the start.
In regular ASPapps I was able to do..
<option> MyValue
I am trying to do the same thing with DropdownList control
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in
messagenews:um******* *******@tk2msft ngp13.phx.gbl.. . Naveen,
Drop down lists don't use the same encoding as regular
html on the page. Just add a regular " " space.
Sincerely,
-- S. Justin Gengo, MCP Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order." Nietzche
"Naveen K Kohli" <na*********@ho tmail.com> wrote in
message news:ON******** ******@TK2MSFTN GP12.phx.gbl... > I am try to set the text of the drop down list item as > > ListItem li = new ListItem(); > li.Text = " "+"MyValue" ; > > myDropDown.Item s.Add("li); > > The intent is to add a spacing in front of the text.
Its not doing whatI am > trying to do. The text shows up as "&MyValue" > > How can this be accomplished? > >
.
I think choice of language was clear. I don't think that VB uses ";" at the
end of statement. Thats not the point.
ListItem truncates the leading spaces. And if you have any HTML decoded
string, it will encode it and display as "&ndp;". The solution to this
issue can be found at floowing link., http://www.netomatix.com/IndentDropdownList.aspx
Naveen
"Tyrone" <t_*******@hotm ail.com> wrote in message
news:08******** *************** *****@phx.gbl.. . What I think the issue is is that you are using the "+" to add both strings..i think you must use the & char.
Well in VB.Net in C# your right on the money I think..you use the "+"..but you didn't specify any language
ListItem li = new ListItem(); li.Text = " " & "MyValue";
myDropDown.Item s.Add("li");
-----Original Message----- Thanks Justin, I tried that. It truncates the blank spaces at the start. In regular ASPapps I was able to do..
<option> MyValue
I am trying to do the same thing with DropdownList control
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in messagenews:um******* *******@tk2msft ngp13.phx.gbl.. . Naveen,
Drop down lists don't use the same encoding as regular html on the page. Just add a regular " " space.
Sincerely,
-- S. Justin Gengo, MCP Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order." Nietzche
"Naveen K Kohli" <na*********@ho tmail.com> wrote in message news:ON******** ******@TK2MSFTN GP12.phx.gbl... > I am try to set the text of the drop down list item as > > ListItem li = new ListItem(); > li.Text = " "+"MyValue" ; > > myDropDown.Item s.Add("li); > > The intent is to add a spacing in front of the text. Its not doing whatI am > trying to do. The text shows up as "&MyValue" > > How can this be accomplished? > >
.
The code below should help you out.
--
Regards
John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_auth or_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_autho r_plug>
----------------------------------------------
<%@ Page Language="VB" Debug="true" %>
<script language=VB runat=server>
Sub Page_Load(Sende r As Object, E As EventArgs)
Dim Padding As String
Dim writer As New System.IO.Strin gWriter()
Dim DecodedString As String
Padding = " &nbs p;"
Server.HtmlDeco de(Padding, writer)
Padding = writer.ToString ()
myDropDownList2 .Items.Add(Padd ing & " MVP's")
Padding = " &n bsp;   ; &n bsp;"
Server.HtmlDeco de(Padding, writer)
Padding = writer.ToString ()
myDropDownList2 .Items.Add(Padd ing & " MVP's")
myDropDownList2 .Items.Add("MVP 's" & Padding & "Do Their best")
End Sub
</script>
<html>
<head><title>Pa dding DropListBox</title></head>
<body><form fred runat="server"> <asp:dropdownli st id="MyDropDownL ist2"
runat="server"/></form></body>
</html>
John,
I did try this before posting the code. Nothing seemed to work. did
not show up as spaces.
Thanks.
"John Timney (Microsoft MVP)" <ti*****@despam med.com> wrote in message
news:eu******** ******@TK2MSFTN GP10.phx.gbl... The code below should help you out. -- Regards
John Timney (Microsoft ASP.NET MVP) ---------------------------------------------- <shameless_auth or_plug> Professional .NET for Java Developers with C# ISBN:1-861007-91-4 Professional Windows Forms ISBN: 1861005547 Professional JSP 2nd Edition ISBN: 1861004958 Professional JSP ISBN: 1861003625 Beginning JSP Web Development ISBN: 1861002092 </shameless_autho r_plug> ----------------------------------------------
<%@ Page Language="VB" Debug="true" %> <script language=VB runat=server>
Sub Page_Load(Sende r As Object, E As EventArgs)
Dim Padding As String Dim writer As New System.IO.Strin gWriter() Dim DecodedString As String
Padding = " &nbs p;" Server.HtmlDeco de(Padding, writer) Padding = writer.ToString ()
myDropDownList2 .Items.Add(Padd ing & " MVP's")
Padding = " &n bsp;   ; &n bsp;" Server.HtmlDeco de(Padding, writer) Padding = writer.ToString ()
myDropDownList2 .Items.Add(Padd ing & " MVP's")
myDropDownList2 .Items.Add("MVP 's" & Padding & "Do Their best")
End Sub
</script> <html> <head><title>Pa dding DropListBox</title></head> <body><form fred runat="server"> <asp:dropdownli st id="MyDropDownL ist2" runat="server"/></form></body> </html> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ian justice |
last post by:
Before i post actual code, as i need a speedyish reply.
Can i first ask if anyone knows off the top of their head, if there is
a likely obvious cause to the following problem.
For the moment i've reduced my form request to a simple text string
entry, instead of my desired optional parameters. As i have been stuck
with a single unfathomable...
|
by: rbronson1976 |
last post by:
Hi all,
I have a very simple page that Firefox has problems with:
www.absolutejava.com/testing.htm
First of all, this page seems to be perfectly valid XHTML Strict. Both
the W3C validator as well as Page Valet indicate it is valid. The page
is being served with the proper MIME type of "application/xhtml+xml".
Unfortunately, Firefox...
|
by: Robert Mark Bram |
last post by:
Hi All,
I am using the following trim function:
function trim (str) {
return str.replace(/^\s*/g, '').replace(/\s*$/g, '');
}
The problem is that this doesn't trim instances of the " " char -
the non breaking space. Can this be represented in a grep statement at
|
by: K B |
last post by:
Hi again,
I have a gridview, when I get the selecteditem.cells for a column, if
the database column is Null or Empty, and I assign that to my web form
text control, the control reads " " instead of a blank.
Never had this happen before, but I am now using Asp.Net 2.0.
Ideas please?
|
by: 一首诗 |
last post by:
Is there any simple way to solve this problem?
| |
by: John Nagle |
last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally
hit content which has something like "Design & Advertising", that is,
an "&" instead of an "&". Is there some way I can get BeautifulSoup
to clean those up? There are various parsing options related to "&"
handling, but none of them seem to do quite the right thing.
If I...
|
by: zaidalin79 |
last post by:
I am in a JavaScript class, and we have to get all of our code to validate at the w3c website... Here is my code, it does what I want it to do which is require the user to enter the name and either the address of the email address, but when I try to validate it through w3c, I get the following errors... Can anyone help?
<!DOCTYPE html...
|
by: bips2008 |
last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated
For your convienence i have posted the code for the file. The portion that is not working is the star rating part
<?php
session_start();
include_once('includes/host_conf.php');...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |