Height of a Datagrid

R

Russ

I want to place a button right below a datagrid. The datagrid has
variable number of items, and the items have variable height. How can
I find the position of the bottom of the grid? I have tried using
Datagrid1.Height, but it is always zero. When, if ever, is the height
value set? Is there any other way to find the height. (C# client)

Thanks, Russ
 
S

Steven Cheng[MSFT]

Hi Russ,

Welcome to ASPNET newsgroup.
Regarding on the question you mentioned, here are some of my suggestions:

For ASP.NET Webform page, it has different programming model from the
traditinal desktop (winform) application, the UI layout of web page is not
postion pages (x, y axis postion). Generally ,we often use some html Table
elements to construct our webpage's layout. For example, we can put a large
table on the page and then use Tablerows can cells to divide the page into
multi sections, also we can add nested Tables to further decorate our
webpage layout. So for your scenario, if you're wanting to add some
additional controls onto the page according to the existing control's
position, I'd recommend that you try use a parent (container ) control,
maybe a HTMLTable or ASP.NET Table control to hold the controls in
different TableRow or TableCell. e.g, you can put the DAtaGRid in a
htmlTable's Row 1 , then, later, you can add the button in the Row2 of the
table so that the Button will surely display under the DataGrid.

Hope helps. Thanks,,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| NNTP-Posting-Date: Mon, 19 Sep 2005 13:26:23 -0500
| From: Russ <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Subject: Height of a Datagrid
| Date: Mon, 19 Sep 2005 14:26:22 -0400
| Message-ID: <[email protected]>
| X-Newsreader: Forte Agent 3.0/32.763
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Lines: 7
| NNTP-Posting-Host: 68.37.155.53
| X-Trace:
sv3-jwAQxBeRbOGsR2pjPsMM5TOB6J62Ra0E0tArPQtHEQc1cyCTyjMzl4art+6H+CxZRK2YoUi4
Im9LoIo!O8aVUvtWUUP1IZFbXmvQYg37s8o+zWF6+YxScOIPpy5GrWSlN7SX5IQyfKZXw23ztGP0
8QIfnEMP!GG80A6Ys
| X-Complaints-To: (e-mail address removed)
| X-DMCA-Complaints-To: (e-mail address removed)
| X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
| X-Postfilter: 1.3.32
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
ews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POST
ED!not-for-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10907
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| I want to place a button right below a datagrid. The datagrid has
| variable number of items, and the items have variable height. How can
| I find the position of the bottom of the grid? I have tried using
| Datagrid1.Height, but it is always zero. When, if ever, is the height
| value set? Is there any other way to find the height. (C# client)
|
| Thanks, Russ
|
 
S

Steven Cheng[MSFT]

Hi Russ,

Howe are you doing on this thread, have you got any further ideas or does
the suggestion in my last reply helps a little? If there're anything else
we can help, please feel free to post here.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| X-Tomcat-ID: 83990125
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 20 Sep 2005 05:28:04 GMT
| Subject: RE: Height of a Datagrid
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Lines: 76
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10924
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Russ,
|
| Welcome to ASPNET newsgroup.
| Regarding on the question you mentioned, here are some of my suggestions:
|
| For ASP.NET Webform page, it has different programming model from the
| traditinal desktop (winform) application, the UI layout of web page is
not
| postion pages (x, y axis postion). Generally ,we often use some html
Table
| elements to construct our webpage's layout. For example, we can put a
large
| table on the page and then use Tablerows can cells to divide the page
into
| multi sections, also we can add nested Tables to further decorate our
| webpage layout. So for your scenario, if you're wanting to add some
| additional controls onto the page according to the existing control's
| position, I'd recommend that you try use a parent (container ) control,
| maybe a HTMLTable or ASP.NET Table control to hold the controls in
| different TableRow or TableCell. e.g, you can put the DAtaGRid in a
| htmlTable's Row 1 , then, later, you can add the button in the Row2 of
the
| table so that the Button will surely display under the DataGrid.
|
| Hope helps. Thanks,,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
| --------------------
| | NNTP-Posting-Date: Mon, 19 Sep 2005 13:26:23 -0500
| | From: Russ <[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | Subject: Height of a Datagrid
| | Date: Mon, 19 Sep 2005 14:26:22 -0400
| | Message-ID: <[email protected]>
| | X-Newsreader: Forte Agent 3.0/32.763
| | MIME-Version: 1.0
| | Content-Type: text/plain; charset=us-ascii
| | Content-Transfer-Encoding: 7bit
| | Lines: 7
| | NNTP-Posting-Host: 68.37.155.53
| | X-Trace:
|
sv3-jwAQxBeRbOGsR2pjPsMM5TOB6J62Ra0E0tArPQtHEQc1cyCTyjMzl4art+6H+CxZRK2YoUi4
|
Im9LoIo!O8aVUvtWUUP1IZFbXmvQYg37s8o+zWF6+YxScOIPpy5GrWSlN7SX5IQyfKZXw23ztGP0
| 8QIfnEMP!GG80A6Ys
| | X-Complaints-To: (e-mail address removed)
| | X-DMCA-Complaints-To: (e-mail address removed)
| | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
| complaint properly
| | X-Postfilter: 1.3.32
| | Path:
|
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
|
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
|
ews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POST
| ED!not-for-mail
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:10907
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| |
| | I want to place a button right below a datagrid. The datagrid has
| | variable number of items, and the items have variable height. How can
| | I find the position of the bottom of the grid? I have tried using
| | Datagrid1.Height, but it is always zero. When, if ever, is the height
| | value set? Is there any other way to find the height. (C# client)
| |
| | Thanks, Russ
| |
|
|
 
R

Russ

Steven, thank you for your response. I got quite busy with other
things lately, so I am just now getting back to this issue. I will
look into what you suggest - it sounds reasonable. In the meanwhile I
did find another way - how reliable it is remains to be seen.

Basically, I created my own class variable to hold the height of the
datagrid table. Each time the ItemDataBound function is called, the
height of the new item is calculated and added to this variable. This
calculation was done by carefully measuring the additional height that
is used by each line, multiplying by # of lines, and then adding a
fixed amount for overhead for each item. (Actually each item in the
datagrid is another variable size datagrid, but the same principle
applies.)

This seems to work quite well as my button is placed just the same
distance below the datagrid no matter if the grid contains only 1
item, or ten of varying sizes.

Thanks again for your help.

Regards, Russ

Hi Russ,

Howe are you doing on this thread, have you got any further ideas or does
the suggestion in my last reply helps a little? If there're anything else
we can help, please feel free to post here.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| X-Tomcat-ID: 83990125
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 20 Sep 2005 05:28:04 GMT
| Subject: RE: Height of a Datagrid
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Lines: 76
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10924
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Russ,
|
| Welcome to ASPNET newsgroup.
| Regarding on the question you mentioned, here are some of my suggestions:
|
| For ASP.NET Webform page, it has different programming model from the
| traditinal desktop (winform) application, the UI layout of web page is
not
| postion pages (x, y axis postion). Generally ,we often use some html
Table
| elements to construct our webpage's layout. For example, we can put a
large
| table on the page and then use Tablerows can cells to divide the page
into
| multi sections, also we can add nested Tables to further decorate our
| webpage layout. So for your scenario, if you're wanting to add some
| additional controls onto the page according to the existing control's
| position, I'd recommend that you try use a parent (container ) control,
| maybe a HTMLTable or ASP.NET Table control to hold the controls in
| different TableRow or TableCell. e.g, you can put the DAtaGRid in a
| htmlTable's Row 1 , then, later, you can add the button in the Row2 of
the
| table so that the Button will surely display under the DataGrid.
|
| Hope helps. Thanks,,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
| --------------------
| | NNTP-Posting-Date: Mon, 19 Sep 2005 13:26:23 -0500
| | From: Russ <[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | Subject: Height of a Datagrid
| | Date: Mon, 19 Sep 2005 14:26:22 -0400
| | Message-ID: <[email protected]>
| | X-Newsreader: Forte Agent 3.0/32.763
| | MIME-Version: 1.0
| | Content-Type: text/plain; charset=us-ascii
| | Content-Transfer-Encoding: 7bit
| | Lines: 7
| | NNTP-Posting-Host: 68.37.155.53
| | X-Trace:
|
sv3-jwAQxBeRbOGsR2pjPsMM5TOB6J62Ra0E0tArPQtHEQc1cyCTyjMzl4art+6H+CxZRK2YoUi4
|
Im9LoIo!O8aVUvtWUUP1IZFbXmvQYg37s8o+zWF6+YxScOIPpy5GrWSlN7SX5IQyfKZXw23ztGP0
| 8QIfnEMP!GG80A6Ys
| | X-Complaints-To: (e-mail address removed)
| | X-DMCA-Complaints-To: (e-mail address removed)
| | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
| complaint properly
| | X-Postfilter: 1.3.32
| | Path:
|
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
|
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
|
ews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POST
| ED!not-for-mail
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:10907
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| |
| | I want to place a button right below a datagrid. The datagrid has
| | variable number of items, and the items have variable height. How can
| | I find the position of the bottom of the grid? I have tried using
| | Datagrid1.Height, but it is always zero. When, if ever, is the height
| | value set? Is there any other way to find the height. (C# client)
| |
| | Thanks, Russ
| |
|
|
 
S

Steven Cheng[MSFT]

Thanks for your followup Russ,

Glad that you've also found a creative approach ;-). If you need any
further help later, please feel free to post here.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| NNTP-Posting-Date: Tue, 27 Sep 2005 11:02:15 -0500
| From: Russ <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Subject: Re: Height of a Datagrid
| Date: Tue, 27 Sep 2005 12:02:13 -0400
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| X-Newsreader: Forte Agent 3.0/32.763
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Lines: 141
| NNTP-Posting-Host: 68.37.155.53
| X-Trace:
sv3-b4XBtyo8mlCfHU+TIBxWKAWXwihD7oCNtxhhN98V5G2ViekTTcQIhMorJOIrLyBArdF+KmC2
CIUBDBX!DzdebVpmeuaJM5ncUeLowXaxIpJ6C/B87ZxL6FXIZ8Ylfwcp7+S9sBqCOQmry0cmpiuf
yYwQugmJ!3+BgRgGk
| X-Complaints-To: (e-mail address removed)
| X-DMCA-Complaints-To: (e-mail address removed)
| X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
| X-Postfilter: 1.3.32
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.
sul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!border1.nntp.dca.g
iganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com
!news.comcast.com.POSTED!not-for-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:11044
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven, thank you for your response. I got quite busy with other
| things lately, so I am just now getting back to this issue. I will
| look into what you suggest - it sounds reasonable. In the meanwhile I
| did find another way - how reliable it is remains to be seen.
|
| Basically, I created my own class variable to hold the height of the
| datagrid table. Each time the ItemDataBound function is called, the
| height of the new item is calculated and added to this variable. This
| calculation was done by carefully measuring the additional height that
| is used by each line, multiplying by # of lines, and then adding a
| fixed amount for overhead for each item. (Actually each item in the
| datagrid is another variable size datagrid, but the same principle
| applies.)
|
| This seems to work quite well as my button is placed just the same
| distance below the datagrid no matter if the grid contains only 1
| item, or ten of varying sizes.
|
| Thanks again for your help.
|
| Regards, Russ
|
| On Thu, 22 Sep 2005 08:21:45 GMT, (e-mail address removed) (Steven
| Cheng[MSFT]) wrote:
|
| >Hi Russ,
| >
| >Howe are you doing on this thread, have you got any further ideas or
does
| >the suggestion in my last reply helps a little? If there're anything
else
| >we can help, please feel free to post here.
| >
| >Thanks & Regards,
| >
| >Steven Cheng
| >Microsoft Online Support
| >
| >Get Secure! www.microsoft.com/security
| >(This posting is provided "AS IS", with no warranties, and confers no
| >rights.)
| >
| >
| >--------------------
| >| X-Tomcat-ID: 83990125
| >| References: <[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain
| >| Content-Transfer-Encoding: 7bit
| >| From: (e-mail address removed) (Steven Cheng[MSFT])
| >| Organization: Microsoft
| >| Date: Tue, 20 Sep 2005 05:28:04 GMT
| >| Subject: RE: Height of a Datagrid
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| >| Message-ID: <[email protected]>
| >| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| >| Lines: 76
| >| Path: TK2MSFTNGXA01.phx.gbl
| >| Xref: TK2MSFTNGXA01.phx.gbl
| >microsoft.public.dotnet.framework.aspnet.webcontrols:10924
| >| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
| >|
| >| Hi Russ,
| >|
| >| Welcome to ASPNET newsgroup.
| >| Regarding on the question you mentioned, here are some of my
suggestions:
| >|
| >| For ASP.NET Webform page, it has different programming model from the
| >| traditinal desktop (winform) application, the UI layout of web page is
| >not
| >| postion pages (x, y axis postion). Generally ,we often use some html
| >Table
| >| elements to construct our webpage's layout. For example, we can put a
| >large
| >| table on the page and then use Tablerows can cells to divide the page
| >into
| >| multi sections, also we can add nested Tables to further decorate our
| >| webpage layout. So for your scenario, if you're wanting to add some
| >| additional controls onto the page according to the existing control's
| >| position, I'd recommend that you try use a parent (container )
control,
| >| maybe a HTMLTable or ASP.NET Table control to hold the controls in
| >| different TableRow or TableCell. e.g, you can put the DAtaGRid in a
| >| htmlTable's Row 1 , then, later, you can add the button in the Row2 of
| >the
| >| table so that the Button will surely display under the DataGrid.
| >|
| >| Hope helps. Thanks,,
| >|
| >| Steven Cheng
| >| Microsoft Online Support
| >|
| >| Get Secure! www.microsoft.com/security
| >| (This posting is provided "AS IS", with no warranties, and confers no
| >| rights.)
| >|
| >|
| >| --------------------
| >| | NNTP-Posting-Date: Mon, 19 Sep 2005 13:26:23 -0500
| >| | From: Russ <[email protected]>
| >| | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| >| | Subject: Height of a Datagrid
| >| | Date: Mon, 19 Sep 2005 14:26:22 -0400
| >| | Message-ID: <[email protected]>
| >| | X-Newsreader: Forte Agent 3.0/32.763
| >| | MIME-Version: 1.0
| >| | Content-Type: text/plain; charset=us-ascii
| >| | Content-Transfer-Encoding: 7bit
| >| | Lines: 7
| >| | NNTP-Posting-Host: 68.37.155.53
| >| | X-Trace:
| >|
|
sv3-jwAQxBeRbOGsR2pjPsMM5TOB6J62Ra0E0tArPQtHEQc1cyCTyjMzl4art+6H+CxZRK2YoUi
4
| >|
|
Im9LoIo!O8aVUvtWUUP1IZFbXmvQYg37s8o+zWF6+YxScOIPpy5GrWSlN7SX5IQyfKZXw23ztGP
0
| >| 8QIfnEMP!GG80A6Ys
| >| | X-Complaints-To: (e-mail address removed)
| >| | X-DMCA-Complaints-To: (e-mail address removed)
| >| | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL
headers
| >| | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
| >| complaint properly
| >| | X-Postfilter: 1.3.32
| >| | Path:
| >|
|
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onl
i
| >|
|
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giga
n
| >|
|
ews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POS
T
| >| ED!not-for-mail
| >| | Xref: TK2MSFTNGXA01.phx.gbl
| >| microsoft.public.dotnet.framework.aspnet.webcontrols:10907
| >| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| >| |
| >| | I want to place a button right below a datagrid. The datagrid has
| >| | variable number of items, and the items have variable height. How
can
| >| | I find the position of the bottom of the grid? I have tried using
| >| | Datagrid1.Height, but it is always zero. When, if ever, is the
height
| >| | value set? Is there any other way to find the height. (C# client)
| >| |
| >| | Thanks, Russ
| >| |
| >|
| >|
|
 

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
474,264
Messages
2,571,065
Members
48,770
Latest member
ElysaD

Latest Threads

Top