user2384794
user2384794

Reputation: 63

How to set the style for border of gridview?

in the following is my gridview and i want to delete all borders.

How could be this possible to do? because i tried a lot but couldn't got succeeded.

gridview

Upvotes: 2

Views: 21097

Answers (3)

DiederikEEn
DiederikEEn

Reputation: 743

2 ways. You can do this with design view click on the gridview and choose Gridlines:both to Gridlines:none or give the grid a cssclass and the nborder:none

Upvotes: 1

Simon Dugré
Simon Dugré

Reputation: 18916

Have you tried to set the property "GridLines" to "none" of the gridview? It should make it.

Otherwise, you could try to to create as CSS Class ;

<style type="text/css">
    .MyClass {
        border:none // As @DiederikEEn said.
    }
    .MyClass td{
        border:none // As @DiederikEEn said.
    }
</style>

And set a the CssClass of your gridview like that :

<asp:GridView runat="server" id="myGridView" CssClass="MyClass">
     [...]
</asp:GridView

Upvotes: 1

Freelancer
Freelancer

Reputation: 9074

You will have to Add RowDataBound event in GridView control:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        TableCell tCell = e.Row.Cells[2];
        tCell.Attributes["style"] = "border-right:0";
    }

Also Try With

<ItemStyle border="0" />

With Properties:

BorderStyle>>RowStyle:none

Hope Its Helpful.

Upvotes: 3

Related Questions