Monday, December 17, 2007

Prevent DataGridViewImageColumn from showing a red x

When you use a DataGridViewImage column within a DataGridView, a red "x" will show up if you do not anything bound to the row in question. What this means is that if you have an edit row at the end, it will show the red "x". Unfortunately, neither the official documentation for DataGridViewImageColumn in MSDN nor the forum are very clear on this. I gleaned off one of the last posts which recommended creating a new blank bitmap. Instead, I set my cell value to the value of the image I already set up in designer. For a DataGridView that is not getting databound, you will need to put this in the form load.

private void myGrid_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
//assumes that image column is first column
myGrid.Rows[myGrid.Rows.Count - 1].Cells[0].Value =

((DataGridViewImageColumn) myGrid.Columns[0]).Image;

Experts Exchange - Officially Banned!

This used to be a great site, but is now full of pop-ups and annoying ads.

Thursday, December 13, 2007

Windows Vista - Windows Update reboot prompts during separate installation.

Dear Windows Vista,

Why do you ask me to reboot when I'm in the middle of installing something? What's confusing here is that I don't know if this is related to the Visual Studio 2008 install or something else that was being installed in the background. Don't get me wrong, I am a fan of the silent updates, but it would be nice to understand what's going on here. Alas, the VS installation progress bar is still moving...

Wednesday, December 5, 2007

MOSS 2007 Overrides GridView Header in Web Part

I had created a Web Part with a GridView and explicitly set the header background color to dark blue and the forecolor to white.

     <asp:GridView ID="UserGroupsTable" runat="server" >
          lt;HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />

Unfortunately, SharePoint overrode the style somehow with the core.css file. After a bit of troubleshooting in SharePoint designer, I got it working by overriding the CSS for the web part page.

     .ms-propertysheet th

For more information on MOSS 2007 CSS, check out Heather's site:

Heather Solomon - CSS Reference Chart