remove the border=1 from GridView control

Discussion in 'ASP .Net' started by Andy Fish, Nov 19, 2007.

  1. Andy Fish

    Andy Fish Guest

    hi,

    I have a gridview control on my asp.net page and it generates <table ...
    border="1" > in the html

    i am using CSS to render the site, and everything is set up so that a plain
    <table> tag generates everything looking correct. this was great for normal
    tables, but datagrid screws it up.

    is there any way to stop it generating the border attribute at all? it seems
    pretty dumb that it is always rendering this.

    Andy
    Andy Fish, Nov 19, 2007
    #1
    1. Advertising

  2. Andy Fish

    David Wier Guest

    Look in the Gridview attributes - probably, your Gridview has Border=1 in it


    David Wier
    http://aspnet101.com
    http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
    bloated markup


    "Andy Fish" <> wrote in message
    news:...
    > hi,
    >
    > I have a gridview control on my asp.net page and it generates <table ...
    > border="1" > in the html
    >
    > i am using CSS to render the site, and everything is set up so that a
    > plain <table> tag generates everything looking correct. this was great for
    > normal tables, but datagrid screws it up.
    >
    > is there any way to stop it generating the border attribute at all? it
    > seems pretty dumb that it is always rendering this.
    >
    > Andy
    >
    >
    >
    David Wier, Nov 19, 2007
    #2
    1. Advertising

  3. Andy Fish

    Andy Fish Guest

    no - gridview doesn't have an attribute called border. it has one called
    "borderwidth" which is set to blank.

    if I set borderwidth to anything other than blank it will output that as the
    border attribute. what I want is no border attribute at all

    Andy


    "David Wier" <> wrote in message
    news:...
    > Look in the Gridview attributes - probably, your Gridview has Border=1 in
    > it
    >
    >
    > David Wier
    > http://aspnet101.com
    > http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with
    > no bloated markup
    >
    >
    > "Andy Fish" <> wrote in message
    > news:...
    >> hi,
    >>
    >> I have a gridview control on my asp.net page and it generates <table ...
    >> border="1" > in the html
    >>
    >> i am using CSS to render the site, and everything is set up so that a
    >> plain <table> tag generates everything looking correct. this was great
    >> for normal tables, but datagrid screws it up.
    >>
    >> is there any way to stop it generating the border attribute at all? it
    >> seems pretty dumb that it is always rendering this.
    >>
    >> Andy
    >>
    >>
    >>

    >
    >
    Andy Fish, Nov 19, 2007
    #3
  4. Andy Fish

    marss Guest

    On 19 ìÉÓ, 17:30, "Andy Fish" <> wrote:
    > no - gridview doesn't have an attribute called border. it has one called
    > "borderwidth" which is set to blank.
    >
    > if I set borderwidth to anything other than blank it will output that as the
    > border attribute. what I want is no border attribute at all
    >
    > Andy


    Set GridLines="None"

    Regards,
    Mykola
    http://marss.co.ua
    marss, Nov 19, 2007
    #4
  5. Andy Fish

    Andy Fish Guest

    I don't want no border - i want no border attribute in the html

    i want it to use the standard style for a table as defined in my CSS without
    overriding the border

    "marss" <> wrote in message
    news:...
    On 19 ìÉÓ, 17:30, "Andy Fish" <> wrote:
    > no - gridview doesn't have an attribute called border. it has one called
    > "borderwidth" which is set to blank.
    >
    > if I set borderwidth to anything other than blank it will output that as
    > the
    > border attribute. what I want is no border attribute at all
    >
    > Andy


    Set GridLines="None"

    Regards,
    Mykola
    http://marss.co.ua
    Andy Fish, Nov 19, 2007
    #5
  6. Andy Fish

    marss Guest

    On 20 ìÉÓ, 00:18, "Andy Fish" <> wrote:

    > I don't want no border - i want no border attribute in the html


    Hi Andy,

    I do not like peremptory statements either, but I think you can't do
    it in an easy way. If there is an essential need to get rid of border
    attribute you can play with overriding of RenderControl method.

    Regards,
    Mykola
    http://marss.co.ua
    marss, Nov 20, 2007
    #6
  7. Andy Fish

    Andy Fish Guest

    ok thanks

    I tried overriding the pre-render method and setting

    grd.Attributes["border"]="" but that generated

    <table border="" border="1">

    which was not exactly helpful.

    Setting the cssclass causes the border attribute to be left off, so I have
    ended up just having a css class table.grid which does the same thing as
    table

    "marss" <> wrote in message
    news:...
    On 20 ìÉÓ, 00:18, "Andy Fish" <> wrote:

    > I don't want no border - i want no border attribute in the html


    Hi Andy,

    I do not like peremptory statements either, but I think you can't do
    it in an easy way. If there is an essential need to get rid of border
    attribute you can play with overriding of RenderControl method.

    Regards,
    Mykola
    http://marss.co.ua
    Andy Fish, Nov 21, 2007
    #7
  8. Andy Fish

    Syed Guest

    Hi,
    You can remove the border tag by selecting the Auto Format under the common control tasks of Gridview.

    Go to design view of Gridview-> Click on GridView tasks->
    Auto Format->Select Professional

    and you no more see the border o the GridView. To change the Colors of Professional for RowStyle and AlternatingRowStyle. Go to the HTML view and change the colors accordingly.

    Hope it helps.




    Andy Fish wrote:

    remove the border=1 from GridView control
    19-Nov-07

    hi

    I have a gridview control on my asp.net page and it generates <table ...
    border="1" > in the htm

    i am using CSS to render the site, and everything is set up so that a plain
    <table> tag generates everything looking correct. this was great for normal
    tables, but datagrid screws it up

    is there any way to stop it generating the border attribute at all? it seems
    pretty dumb that it is always rendering this

    Andy

    Previous Posts In This Thread:

    On Monday, November 19, 2007 9:46 AM
    Andy Fish wrote:

    remove the border=1 from GridView control
    hi

    I have a gridview control on my asp.net page and it generates <table ...
    border="1" > in the htm

    i am using CSS to render the site, and everything is set up so that a plain
    <table> tag generates everything looking correct. this was great for normal
    tables, but datagrid screws it up

    is there any way to stop it generating the border attribute at all? it seems
    pretty dumb that it is always rendering this

    Andy

    On Monday, November 19, 2007 10:03 AM
    David Wier wrote:

    Look in the Gridview attributes - probably, your Gridview has Border=1 in
    Look in the Gridview attributes - probably, your Gridview has Border=1 in i

    David Wie
    http://aspnet101.co
    http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
    bloated marku

    "Andy Fish" <> wrote in message
    news:...

    On Monday, November 19, 2007 10:30 AM
    Andy Fish wrote:

    no - gridview doesn't have an attribute called border.
    no - gridview doesn't have an attribute called border. it has one called
    "borderwidth" which is set to blank

    if I set borderwidth to anything other than blank it will output that as the
    border attribute. what I want is no border attribute at al

    And

    "David Wier" <> wrote in message
    news:...

    On Monday, November 19, 2007 5:18 PM
    Andy Fish wrote:

    I don't want no border - i want no border attribute in the htmli want it to
    I don't want no border - i want no border attribute in the htm

    i want it to use the standard style for a table as defined in my CSS without
    overriding the borde

    "marss" <> wrote in message
    news:..
    On 19 ???, 17:30, "Andy Fish" <> wrote

    Set GridLines="None

    Regards
    Mykol
    http://marss.co.ua

    On Tuesday, November 20, 2007 6:24 AM
    marss wrote:

    Re: remove the border=1 from GridView control
    h

    Set GridLines=3D"None

    Regards
    Mykol
    http://marss.co.ua

    On Tuesday, November 20, 2007 6:24 AM
    marss wrote:

    Re: remove the border=1 from GridView control
    On 20 =EC=C9=D3, 00:18, "Andy Fish" <> wrote

    Hi Andy

    I do not like peremptory statements either, but I think you can't d
    it in an easy way. If there is an essential need to get rid of borde
    attribute you can play with overriding of RenderControl method

    Regards
    Mykol
    http://marss.co.ua

    On Wednesday, November 21, 2007 2:49 AM
    Andy Fish wrote:

    ok thanksI tried overriding the pre-render method and settinggrd.
    ok thank

    I tried overriding the pre-render method and settin

    grd.Attributes["border"]="" but that generate

    <table border="" border="1"

    which was not exactly helpful

    Setting the cssclass causes the border attribute to be left off, so I have
    ended up just having a css class table.grid which does the same thing as
    tabl

    "marss" <> wrote in message
    news:..
    On 20 ???, 00:18, "Andy Fish" <> wrote:


    Hi Andy,

    I do not like peremptory statements either, but I think you can't do
    it in an easy way. If there is an essential need to get rid of border
    attribute you can play with overriding of RenderControl method.

    Regards,
    Mykola
    http://marss.co.ua


    Submitted via EggHeadCafe - Software Developer Portal of Choice
    Win a free Professional license of CodeSmith Generator 5.2!
    http://www.eggheadcafe.com/tutorial...sional-license-of-codesmith-generator-52.aspx
    Syed, Jul 22, 2010
    #8
    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. tshad
    Replies:
    0
    Views:
    2,240
    tshad
    Jan 31, 2005
  2. Replies:
    5
    Views:
    11,423
    khanate
    Aug 16, 2006
  3. phl
    Replies:
    1
    Views:
    4,330
    Martin Jay
    Jun 8, 2006
  4. Coder
    Replies:
    1
    Views:
    682
    Cowboy \(Gregory A. Beamer\)
    Jun 24, 2006
  5. =?UTF-8?B?TWFydGluIFDDtnBwaW5n?=

    border-color: #003366; border-width: 2px;

    =?UTF-8?B?TWFydGluIFDDtnBwaW5n?=, Jul 17, 2006, in forum: HTML
    Replies:
    64
    Views:
    3,487
    Adrienne Boswell
    Jul 30, 2006
Loading...

Share This Page