Normally this should be pretty straight forward.  However, today I had a custom Silverlight web part that had the vertical scroll bar appear whenever I set it to a fixed height.  It wasn’t that the content was too large for the fix height, it just felt I needed the scroll bar and no matter how large I set the height, it still appeared.  The fix to removing the scroll bar is to add the CSS:

#ctl00_m_g_4d68d6ac_9970_465f_8541_e7a54d4ae37b{overflow: hidden !important;}

That’s all fine and dandy except for the fact that this ID changes every time you add a web part to the site.  So if this is a web part you are going to allow others to add or deliver to a client, you don’t want to manually have to add the CSS every time a new web part gets added.  So, my work around was adding the following code to the code behind for my web part.

Where the Title.Contains(“[Title”]) is the title that is assigned to the web part rather than the “Display Title” which is the title that can be changed when editing the web part properties on the page.

This will make sure the scroll bar is hidden no matter what the user may title the web part.  Also, in my case, I put it in a for loop due to the fact that this custom Silverlight web part may be placed on the site multiple times and I need to hide the scroll bar in each instance of the web part.

This is the best way I found to hide the scroll bar.  If anyone else has a better way or even a more efficient way of getting the ID for a particular web part I would love to hear it.