|
|
|
start date: Thu, 16 Aug 2007 17:05:18 -0500,
posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol
back
| Thread Index |
|
1
Joe Stateson
|
|
2
Sergey Poberezovskiy
|
|
3
Joe Stateson
|
problem ordering buttons vertically in cell
In one cell of a datagridview I want to put two buttons. I got this to work
easily using
thisButton = new HtmlButton();
e.Row.Cells[5].Controls.Add(thisButton);
thisButton = new HtmlButton();
e.Row.Cells[5].Controls.Add(thisButton);
======BUT=====
I want them to be centered, at least horizontally, and one below the other,
not in a straight line like the above gives.
The best I could get this to come out was to use a negative pixel offset on
the second button and make it relative as in ...
thisButton.Style.Add(HtmlTextWriterStyle.Top, "0px");
thisButton.Style.Add(HtmlTextWriterStyle.Position, "static");
e.Row.Cells[5].Controls.Add(thisButton);
thisButton = new HtmlButton();
thisButton.Style.Add(HtmlTextWriterStyle.Position, "relative")
thisButton.Style.Add(HtmlTextWriterStyle.Top, "32px");
thisButton.Style.Add(HtmlTextWriterStyle.Left, "-64px");
I tried various combinations of setting the grid control field item style
alignment, but I could not get away from using the -64px which moves the
second button to the left by the width of the first button which is 64. The
height of both buttons is 32 so that is why the "Top" was set to 32 on the
second button.
Is there a cleaner way to do this where I dont have to specify a negative
pixel. I turned on wrap, but that did nothing.
...thanks..
Date:Thu, 16 Aug 2007 17:05:18 -0500
Author:
|
RE: problem ordering buttons vertically in cell
why not insert a break rule in between the buttons, and make the cell centered?
TableCell cell = e.Row.Cells[5];
ControlCollection controls = cell.Controls;
thisButton = new HtmlButton();
controls.Add(thisButton);
controls.Add(new Literal("<br/>");
thisButton = new HtmlButton();
controls.Add(thisButton);
cell.HorizontalAlign = HorizontalAlign.Center;
"Joe Stateson" wrote:
> In one cell of a datagridview I want to put two buttons. I got this to work
> easily using
> thisButton = new HtmlButton();
> e.Row.Cells[5].Controls.Add(thisButton);
> thisButton = new HtmlButton();
> e.Row.Cells[5].Controls.Add(thisButton);
> ======BUT=====
> I want them to be centered, at least horizontally, and one below the other,
> not in a straight line like the above gives.
>
> The best I could get this to come out was to use a negative pixel offset on
> the second button and make it relative as in ...
>
>
> thisButton.Style.Add(HtmlTextWriterStyle.Top, "0px");
> thisButton.Style.Add(HtmlTextWriterStyle.Position, "static");
> e.Row.Cells[5].Controls.Add(thisButton);
> thisButton = new HtmlButton();
> thisButton.Style.Add(HtmlTextWriterStyle.Position, "relative")
> thisButton.Style.Add(HtmlTextWriterStyle.Top, "32px");
> thisButton.Style.Add(HtmlTextWriterStyle.Left, "-64px");
>
>
> I tried various combinations of setting the grid control field item style
> alignment, but I could not get away from using the -64px which moves the
> second button to the left by the width of the first button which is 64. The
> height of both buttons is 32 so that is why the "Top" was set to 32 on the
> second button.
>
>
> Is there a cleaner way to do this where I dont have to specify a negative
> pixel. I turned on wrap, but that did nothing.
>
> ...thanks..
>
>
Date:Thu, 16 Aug 2007 19:12:02 -0700
Author:
|
Re: problem ordering buttons vertically in cell
"Sergey Poberezovskiy" wrote
in message news:43DD5125-551A-42AA-B77A-89F4582722C4@microsoft.com...
> why not insert a break rule in between the buttons, and make the cell
> centered?
>
> TableCell cell = e.Row.Cells[5];
> ControlCollection controls = cell.Controls;
> thisButton = new HtmlButton();
> controls.Add(thisButton);
> controls.Add(new Literal("<br/>");
> thisButton = new HtmlButton();
> controls.Add(thisButton);
> cell.HorizontalAlign = HorizontalAlign.Center;
>
thanks Sergey, that did it. I changed the above literal code to ..
Literal thisLiteral = new Literal();
thisLiteral.Text = "<br/>";
Date:Fri, 17 Aug 2007 10:50:59 -0500
Author:
|
|
|