why is the footerrow.cells widths always zero?http://forums.asp.net/t/1797433.aspx/1?why+is+the+footerrow+cells+widths+always+zero+Wed, 02 May 2012 12:33:03 -040017974334953482http://forums.asp.net/p/1797433/4953482.aspx/1?why+is+the+footerrow+cells+widths+always+zero+why is the footerrow.cells widths always zero? <p>i'd LIKE to be able to alter the width of my footerrow's first cell. i can view and even set the text of the cell. but why are the footerrow cells widths always 0?</p> <p>no matter what's in them</p> <p></p> <p></p> 2012-04-26T17:56:37-04:004953581http://forums.asp.net/p/1797433/4953581.aspx/1?Re+why+is+the+footerrow+cells+widths+always+zero+Re: why is the footerrow.cells widths always zero? <p>FooterRows from what&nbsp;I have seen always just seem to inherit their width from the cells above.&nbsp; I was able to assign the footer rows a width value using the onrowcreated event.</p> <pre class="prettyprint">Sub SetCellWidth(ByVal sender As Object, ByVal e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.Footer Then e.Row.Cells(0).Width = New Unit(60, UnitType.Pixel) e.Row.Cells(1).Width = New Unit(60, UnitType.Pixel) e.Row.Cells(2).Width = New Unit(60, UnitType.Pixel) e.Row.Cells(3).Width = New Unit(300, UnitType.Pixel) e.Row.Cells(4).Width = New Unit(60, UnitType.Pixel) e.Row.Cells(5).Width = New Unit(60, UnitType.Pixel) e.Row.Cells(6).Width = New Unit(60, UnitType.Pixel) End If End Sub</pre> <p></p> <p>&nbsp;</p> <p>&nbsp;</p> 2012-04-26T19:11:01-04:004953596http://forums.asp.net/p/1797433/4953596.aspx/1?Re+why+is+the+footerrow+cells+widths+always+zero+Re: why is the footerrow.cells widths always zero? <p>my whole problem is this:</p> <p>i have two grids and after the second grid (which has a footer showing it's totals - as does the first grid) i need to display something which will show grand totals - the sum of the totals between both grids</p> <p>currently i am just using a table but i ran into an issue as the cells don't expand the same as the cells in the grids</p> <p>my idea was to detect the width of the cell in the grid and just make the width of the table td the same</p> <p>but apparently there is NO WAY to get the width of a grid cell</p> <p></p> <p></p> 2012-04-26T19:20:51-04:004953651http://forums.asp.net/p/1797433/4953651.aspx/1?Re+why+is+the+footerrow+cells+widths+always+zero+Re: why is the footerrow.cells widths always zero? <p>Ahhh...no.&nbsp; I ran into almost this exact same problem when exporting a gridview to an xml file and trying to set the widths of the cells in the xml equal to or trying to use a linear equation to determine the best cell width in the xml doc based on the gridview's cell width.&nbsp; Everytime I tried to get the value of the width of the cell it was always 0.</p> <p>This is why I had to use the onrowcreated event to set a cell width for the cells.&nbsp; By doing this I was able to create a variable = cell.width.&nbsp; Otherwise like you're saying my widths were always 0.&nbsp; If you're allowing the cell widths to be dynmaic when the gridview is created then I have absolutely no idea how you will be able to get the width.</p> <p>If you're dealing with numbers what you could try and do is use a linear equation based on the length of the value in the cell.&nbsp; So say 0 represents the widest character value in the cell.&nbsp; Now let's assume that 0 represents a width of 2.&nbsp; You could do something like cell.width = Len(Cell.Text)*2</p> <p>This may be close enough that the data your presenting would be neat enough for your standards.</p> <p>If someone is able to tell you how to extract the cell width from a dynamic cell then I'm all ears.&nbsp; I struggled with that exact same problem and in the end just decided to use the onrowcreated to set the cell width values so I could pull them.&nbsp; It just meant I had to play with width values until I found just the right combination of widths for my cells to present the user with a clean enough xml doc to satisfy me.</p> 2012-04-26T20:00:29-04:004961678http://forums.asp.net/p/1797433/4961678.aspx/1?Re+why+is+the+footerrow+cells+widths+always+zero+Re: why is the footerrow.cells widths always zero? <p>Width (and Height) is used only to explicitly specify size. If it is not set, the size is determined by the browser. This size is never known server side.</p> <p>You may want to consider using ListView instead of GridView. With that you can have the ListViews make trs and tds, and wrap it all in a single table. Then you can make the grand total as just another tr with tds, within the same table.&nbsp;</p> 2012-05-02T11:19:03-04:004961698http://forums.asp.net/p/1797433/4961698.aspx/1?Re+why+is+the+footerrow+cells+widths+always+zero+Re: why is the footerrow.cells widths always zero? <p>HI</p> <p>In which event of gridview ur altering it's size? see about gridview event</p> 2012-05-02T11:24:49-04:004961849http://forums.asp.net/p/1797433/4961849.aspx/1?Re+why+is+the+footerrow+cells+widths+always+zero+Re: why is the footerrow.cells widths always zero? <p>In all rows width of cell in a column will be same . How can you individually set the width of&nbsp; a cell in a footer row?. I failed to get what do&nbsp; you mean. Please make it clear for me.</p> 2012-05-02T12:33:03-04:00