[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Formatting a GridView table

Posted on 2007-10-11
5
Medium Priority
?
869 Views
Last Modified: 2008-01-09
I've chosen an autoformat style for my GridView control and  then played around  more with the Properties but there are still some things I'd like to do that I don't see offered.

1. I'd like a double vertical line separating the left-most column from the rest of the table.
2. I'd like to change the color of the vertical lines.
3. I'd like a Title row above  the headings row that announces the name of the table
4. I've  turned on sorting so the headings are links that are underlined.  I don't want them to be underlined.

Can anyone tell he how to do any of the above?

Thanks for any input.

steva
0
Comment
Question by:steva
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:skiltz
ID: 20063318
do some research on stylesheets and tables
0
 
LVL 2

Expert Comment

by:SU-30MKI
ID: 20063379
4)If you don't want underline in the hyperlink then for anchor,  take ' text-decoration : none' in style sheet
3) For title row, put the gridview under some table and then in first row take <th> and in second row <td> put the gridview.
2) that you can do by creating  the style for td and by setting the border color.
1) for this use border width, cell padding , cell spacing
0
 

Author Comment

by:steva
ID: 20063641
SU,

The problem here seems to be that the grid view isn't a table until it's rendered into HTML and when ASP.Net  renders it into HTML the styles are put inline.  Therefore, any style ASP.NET  inserts can't be overidden with a style sheet or an  internal <style>...</style> section in the header since these are overridden by any  inline style definitions.  

The link underline was easy to get rid of by adding an internal style section definition

                               a{text-decoration:none}

This worked because ASP.NET hadn't specified any specific text-decoration inline that would block this.

 For my  "Title row" I just put some h2 text centered above the GridView.

I was able to change the color of the vertical lines with a td style, as you suggested, but I think this only worked because ASP.NET set the color in the table element, rather than the cells, which gets overridden by any cell styles. If ASP.NET had set the td styles I don't think I could  have changed  it.
 
The double vertical lines to the right of only the first column I wasn't able to do because I haven't figured out a CSS selector for td and th that only picks the left most column.

When I wrote the question I was really hoping to find a way to get better control over the GridView formatting and do all the things I wanted at that level.  Having to override the GridView formatting with CSS,when you can,  is pretty ugly!

Is this the way you see things?

steva
0
 
LVL 2

Accepted Solution

by:
SU-30MKI earned 2000 total points
ID: 20063980
Steva,

For the double lines, it won't be possible thru css.
better to do it in code behind. find the cell[0] and cell[1].
set cell[0].rightborder width and cell[1] left border width.  then you can achieve it.

We don't have much control over gridview. In order to make the things work you need to do the tweaking either in css or in code behind.

su
0
 

Author Comment

by:steva
ID: 20064030
Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month17 days, 21 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question