Remove EmptyDataTemplate border

I have a GridView in ASP.NET with custom CSS styling, including a border. The EmptyItemTemplate has a message: "No results found" but has a border which I want to remove. I know about this code:

<EmptyDataRowStyle BorderWidth="0" />

However, this applies to the row, not the table itself--so the table border remains. I've also tried applying a custom CSS class to the EmptyDataRowStyle, but this applies to the row, not the table itself.

So how do I remove the border on the EmptyDataTemplate?


I ended up using jQuery. I added this to the GridView:

<EmptyDataRowStyle CssClass="EmptyData" />

And then added this jQuery at the bottom of the page:

$(".EmptyData").parents("table").css("border-width", "0px").prop("border", "0");

datagrid, Hi all, Can advise how not to display the border for for text in the /02/08/​ASPNET-Remove-GridView-Border-From-EmptyDataTemplate.aspx. Create a new CSS class that removes table formatting (borders, backgrounds, padding, margins, etc.). This class will be applied to the GridView only when it has no data. Add a line of code in the OnPreRender() method for each web page or control that has a GridView, conditionally setting the CSS class of the GridView to the aforementioned class.


Use only CSS

<EmptyDataRowStyle CssClass="EmptyData" />

.EmptyData td {
    border-width: 0px !important;
}

GridView EmptyDataTemplate: Get Rid of That Annoying Border!, If you are like me then you may have a CSS table style for your GridView with a specific border. When you use the the EmptyDataTemplate you  member this.EmptyDataTemplate : System.Web.UI.ITemplate with get, set Public Overridable Property EmptyDataTemplate As ITemplate Property Value ITemplate. A ITemplate that contains the custom content for the empty data row. The default value is null, which indicates that this property is not set. Attributes


I ended up solving it by adding GridLines="None":

<asp:DetailsView runat="server" ID="dv" CssClass="noborder" GridLines="None">

CSS:

.noborder { border: none }

Remove EmptyDataTemplate border, Remove EmptyDataTemplate border. I have a GridView in ASP.NET with custom CSS styling, including a border. The EmptyItemTemplate has a message: "No  Remove EmptyDataTemplate border. Ask Question Asked 6 years, 9 months ago. Active 1 year, 2 months ago. Viewed 3k times 1. I have a GridView in ASP.NET with custom


Remove EmptyDataTemplate border, Remove EmptyDataTemplate border. Question. I have a GridView in ASP.NET with custom CSS styling, including a border. The EmptyItemTemplate has a  Methods to remove it such with JS like onfocus="blur()" are even worse and will result in keyboard users being unable to interact with the control. The hacks you can use, that are sort of OK , includes adding :focus { outline: none; } rules when users interacts with the mouse and remove them again if keyboard interaction is detected.


Remove border for a Gridview EmptyDataTemplate but maintain the , how remove borders when emptydatatemplate showing keep them when gridview has data? screenshot. i had same problem. added gridview  Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more Removing rules attribute from asp.net gridview


GridView.CellPadding Property (System.Web.UI.WebControls , Gets or sets the amount of space between the contents of a cell and the cell's border. autogeneratecolumns="true" emptydatatext="No data available. Join a community of over 2.6m developers to have your questions answered on ListView Default Border of UI for ASP.NET AJAX ListView. New here? Start with our free trials.