There are times when you will want to set the color of the grid lines in your GridView - however there is not to my knowledge a way of doing this declaratively. A workaround is to do this by tapping into the GridView's RowDataBound event.

GridView Gridlines

 

First, set the OnRowDataBound property in the markup of the GridView:

OnRowDataBound="MyGrid_RowDataBound"

 

Second, set the color in the OnRowDataBound handler method:

protected void MyGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
     foreach (TableCell tc in e.Row.Cells)
     {
         tc.Attributes["style"] = "border-color: #c3cecc";
     }
}

 

Happy coding :-)

Update 06-01-2009:
See Lee's suggestion in the comments on a quicker way to do this:
Add this to the page Load method: this.GridView1.Attributes.Add("bordercolor", "c3cecc");

kick it on DotNetKicks.com  411ASP.NET



Joining the Twitter Bandwagon

by agrace 27. May 2009 06:16

Follow me on Twitter Well, I've finally succumbed to the World of Twitter. How did I ever live without it? Okay, sarcasm aside, it's fun to play with and what really sold me was Scott Hanselman's blog post on how it can provide us with an alternative to going through the 1-800 recorded messages from hell when trying to get customer support - the idea being that you have a fair chance of getting some attention the next time your cable acts up by mentioning it in Twitter. Apparently big companies are monitoring the big T by using its search facility. Ever wonder what's being said about you?

After signing up and spending an inordinate amount of time trying to conjure up something deep and meaningful under 140 characters, I downloaded TweetDeck. Then I signed up to http://bit.ly which basically provides the same URL-shortening service as http://tinyurl.com, except better. I have yet to check out TBuzz, Twitmatic, Twubs, TweetMic, Tweekdoku, Twadget, Twit4Live, Twittervision, Twitterholic........

Follow me on Twitter

 

It is estimated that there are currently over six million people "tweeting". More and more developers are using it to break news items and get quick answers to coding problems. You can find some of the top names in development circles using Twitter here.

Follow me on Twitter! I will include the Twitter logo in the new CodersBarn facelift.... soon.




Service Pack Expert As usual, I get the latest Microsoft news from Mary-Jo Foley's blog. As a developer, there was a time when I would be rushing to check a new Service Pack's feature list to see if some bug or other was finally resolved. Since the SharePoint SP2 fiasco I'm exercising a little more restraint in applying SPs. I notice that Microsoft is going to push this out with automatic updates on May 30 - luckily SPs are not applied automatically in the SharePoint world. For everybody else, do the sensible thing and apply it to a VM before you hit your development or production machines with it :-)

SP2 Download Links:
* 32-bit
* 64-bit
* ISO

kick it on DotNetKicks.com

Tags: