Dropdowns move text to center

T

tshad

I have dropdowns that I am filling then adding a line " --All--" to the
first item.

I am trying to get it closer to the center (would be nice to be able to
center it).

public void GetClientNames()

{

SqlCommand dbCommand;

dbCommand = new SqlCommand("GetClientName",

new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString));

dbCommand.CommandType = CommandType.StoredProcedure;

dbCommand.Connection.Open();

ddlClient.DataSource =
dbCommand.ExecuteReader(CommandBehavior.CloseConnection);

ddlClient.DataTextField = "ClientName";

ddlClient.DataValueField = "ClientId";

ddlClient.DataBind();

ddlClient.Items.Insert(0, " --All--");

}

Why does it still move "--All--" to the left? I assume it takes out leading
blanks.

Is there a way (other then putting in a whole bunch of " " in front of
them) to move the text a little to the right or center it? Only the first
item not all the items.

Thanks,

Tom
 
G

Guest

I have dropdowns that I am filling then adding a line "      --All--" to the
first item.

I am trying to get it closer to the center (would be nice to be able to
center it).

public void GetClientNames()

{

SqlCommand dbCommand;

dbCommand = new SqlCommand("GetClientName",

new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].Conne­ctionString));

dbCommand.CommandType = CommandType.StoredProcedure;

dbCommand.Connection.Open();

ddlClient.DataSource =
dbCommand.ExecuteReader(CommandBehavior.CloseConnection);

ddlClient.DataTextField = "ClientName";

ddlClient.DataValueField = "ClientId";

ddlClient.DataBind();

ddlClient.Items.Insert(0, "           --All--");

}

Why does it still move "--All--" to the left?  I assume it takes out leading
blanks.

Is there a way (other then putting in a whole bunch of " " in front of
them) to move the text a little to the right or center it?  Only the first
item not all the items.

Thanks,

Tom

No.
 
T

tshad

Mark Rae said:
Because browsers ignore multiple spaces.



No.
I didn't think so.

I thought there mignt have been a way to put a style on one item but wasn't
sure.

Thanks,

Tom
 
T

tshad

Mark Rae said:
You can certainly do that, e.g.

<asp:ListItem style="text-align:center;">A</asp:ListItem>
<asp:ListItem
style="color:Blue;">Antidisestablishmentarianism</asp:ListItem>

The colour style will work but the text alignment style will simply be
ignored because it's not part of the DOM for list items...

Also, the above markup will be flagged as invalid depending on which
DOCTYPE validation you're using...
So I guess it's &nbsp for me.

Thanks,

Tom
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top