Datagrid: aligning a template column

Discussion in 'ASP .Net Datagrid Control' started by d[ - - ]b, May 18, 2004.

  1. d[ - - ]b

    d[ - - ]b Guest

    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
     
    d[ - - ]b, May 18, 2004
    #1
    1. Advertising

  2. d[ - - ]b

    Amar Guest

    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" <> wrote in message news:<c8bsm7$ouv$>...
    > 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
     
    Amar, May 18, 2004
    #2
    1. Advertising

  3. d[ - - ]b

    d[ - - ]b Guest

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

    "Amar" <> wrote in message
    news:...
    > 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" <> wrote in message

    news:<c8bsm7$ouv$>...
    > > 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
     
    d[ - - ]b, May 18, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dexter
    Replies:
    1
    Views:
    439
    Eliyahu Goldin
    Jan 18, 2005
  2. Ken Varn
    Replies:
    1
    Views:
    992
    Ken Varn
    Aug 19, 2005
  3. nemo
    Replies:
    1
    Views:
    4,772
    S. Justin Gengo
    Sep 16, 2005
  4. Vijaya

    Aligning the controls in the item template of the datagrid

    Vijaya, Dec 15, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    208
    Kelly Leahy
    Dec 18, 2003
  5. d[ - - ]b

    Datagrid: aligning a template column?

    d[ - - ]b, May 18, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    277
    Scott Mitchell [MVP]
    May 18, 2004
Loading...

Share This Page