Datagrid: aligning a template column

D

d[ - - ]b

Hi,

Is it possible to align a template column? Tried align, textalign and
itemstyle (but I think that one is for the whole grid?), and nothing works.
It's a simple datagrid, but one field is a dollar ($) value, so I've had to
do a TemplateColumn so that I could make it have the '$'-sign and the
decimal places, but it's aligned to the left which is kinda ugly. Any ideas
how to change this column alone or another way to do this?

Many thanks,
Naomi
 
A

Amar

What i have done is create another table inside the TD


public void InstantiateIn(System.Web.UI.Control container){
CheckBox lc = new CheckBox();
lc.EnableViewState = true;
lc.DataBinding += new EventHandler(BindCol);
Literal startLC = new Literal();
startLC.Text = "<TABLE width=100% border=0 cellspacing=0
cellpading=0><TR><TD align=center>";
Literal endLC = new Literal();
endLC.Text = "</TD></TR></TABLE>";
container.Controls.Add(startLC);
container.Controls.Add(lc);
container.Controls.Add(endLC);
}

Hope it Helps!
 
D

d[ - - ]b

Ok, thanks Amar. I'll give it a go!

Amar said:
What i have done is create another table inside the TD


public void InstantiateIn(System.Web.UI.Control container){
CheckBox lc = new CheckBox();
lc.EnableViewState = true;
lc.DataBinding += new EventHandler(BindCol);
Literal startLC = new Literal();
startLC.Text = "<TABLE width=100% border=0 cellspacing=0
cellpading=0><TR><TD align=center>";
Literal endLC = new Literal();
endLC.Text = "</TD></TR></TABLE>";
container.Controls.Add(startLC);
container.Controls.Add(lc);
container.Controls.Add(endLC);
}

Hope it Helps!

"d[ - - ]b" <[email protected]> wrote in message
Hi,

Is it possible to align a template column? Tried align, textalign and
itemstyle (but I think that one is for the whole grid?), and nothing works.
It's a simple datagrid, but one field is a dollar ($) value, so I've had to
do a TemplateColumn so that I could make it have the '$'-sign and the
decimal places, but it's aligned to the left which is kinda ugly. Any ideas
how to change this column alone or another way to do this?

Many thanks,
Naomi
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top