Hi Brett,
Based on my understanding, you want to change the lines color in the
datagrid control.
Actually, in asp.net, webform datagrid control will render as <table> html
element in client.
For example, if you use Sql Server's default datatable "jobs" to bind the
DataGrid like this:
private void Page_Load(object sender, System.EventArgs e)
{
SqlDataAdapter adapter=new SqlDataAdapter("select * from jobs",
"server=localhost; database=pubs;uid=sa;pwd=");
DataSet ds=new DataSet();
adapter.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
}
At client, it will render something like this:
<table cellspacing="0" rules="all" border="1" id="DataGrid1"
style="height:192px;width:352px;border-collapse:collapse;Z-INDEX: 101;
LEFT: 48px; POSITION: absolute; TOP: 48px">
<tr>
<td>job_id</td><td>job_desc</td><td>max_lvl</td><td>enum</td>
</tr>
........
</table>
You can see that, the grid lines in the DataGrid are actually the borders
of <td> elements in <table> and <tr>, it default color is black. If you
want to give a different color to it, you should apply bordercolor
attribute to the entire <table>. In asp.net server side, you may use
DataGrid.Attributes.Add method to add the attribute. Do like this:
private void Page_Load(object sender, System.EventArgs e)
{
SqlDataAdapter adapter=new SqlDataAdapter("select * from jobs",
"server=localhost; database=pubs;uid=sa;pwd=");
DataSet ds=new DataSet();
adapter.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
this.DataGrid1.Attributes.Add("bordercolor","red");
}
This will render as:
<table cellspacing="0" bordercolor="red" rules="all" border="1"
id="DataGrid1"
style="height:192px;width:352px;border-collapse:collapse;Z-INDEX: 101;
LEFT: 48px; POSITION: absolute; TOP: 48px">
<tr>
<td>job_id</td><td>job_desc</td><td>max_lvl</td><td>enum</td>
</tr>
........
</table>
Then you will get a red grid line DataGrid control.
==============================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.