Why am I not seeing grid lines on my gridview
All of the comments on this post are correct to some extent which is, you mention that the issue must rely in the styles, after going line by line in my style sheets I found the culprit style and was able to get the grid-lines to show.
grid lines are not displaying in grid view
You should use as following
<style type="text/css">
#MainContent_GridView1 {
border: solid 1px Black !important;
}
#MainContent_GridView1 tr {
border: solid 1px Black !important;
}
#MainContent_GridView1 td {
border: solid 1px Black !important;
}
</style>
You need to create class for your tr
and td
you should also look if you have th
is render on your browser if so you need to create class as follow
#MainContent_GridView1 th {
border: solid 1px Black !important;
}
GridView Lines Not Showing up in IE
With the GridView, the declarative bordercolor attribute adds an inline style declaration which only applies to the table itself, not individual cells.
Adding the bordercolor attribute programmatically does not use an inline style, but uses the HTML bordercolor property, which browsers apply to ALL borders inside the table.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
foreach (TableCell tc in e.Row.Cells)
{
tc.Attributes["style"] = "border-color: #c3cecc";
};
}
Internal gridlines in GridView in ASP.NET
protected void Page_Load(object sender, EventArgs e)
{
this.myGrid.Attributes.Add("bordercolor", "#000");
}
With the GridView, the declarative bordercolor attribute adds an inline style declaration which only applies to the table itself, not individual cells.
Adding the bordercolor attribute programmatically does not use an inline style, but uses the HTML bordercolor property, which browsers apply to ALL borders inside the table.
See comments under this blog post:
http://codersbarn.com/post/2009/05/31/Set-Color-of-GridLines-in-Gridview.aspx
Data Grid View not showing data from related models?
TL;DR
Quick fix it with the following. In your DealerAddres
, add
public string BaseUrl
{
get => Dealer.BaseUrl;
set => Dealer.BaseUrl = value;
}
Explaining
You have two class DealerAddress
and Dealer
. You set
a list of DealerAddress
to the DataSource
.
So when the DataGridView
starts to render, it will search the properties
in the first class.
When you do nameof(DealerAddress.Dealer.BaseUrl)
you are actually telling, to the DataGridView
, that the class DealerAddress
contains that property --- which it does not.
See this for more information.
Related Topics
ASP.NET MVC Get Textbox Input Value
How to Render Text in .Net in the Same Size as Browsers Does Given CSS for the Text
C# Webbrowser Control -- Get Document Elements After Ajax
JSON.Net Serialize Object with Root Name
How to Detect Keypress While Not Focused
Linq - Left Join on Multiple (Or) Conditions
Many-To-Many with Extra Columns Nhibernate
How to Test If Type Is Primitive
Modelstate.Isvalid == False, Why
How to Get the HTML Output of a Usercontrol in .Net (C#)
Firefox Browser Does Not Reload the Update CSS/Js Files
How to Use the Cancellationtoken Property
Best .Net Memory and Performance Profiler
Selenium Error - the Http Request to the Remote Webdriver Timed Out After 60 Seconds
Get the Icon for a Given Extension
Convert Arabic"Unicode" Content HTML or Xml to PDF Using Itextsharp