Skip to main content

Remove the Scroll Bar from a Custom SharePoint Web Part


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.

Comments

  1. www.internetworkconsulting.net

    I will show you the easiest way.

    ReplyDelete
  2. Thanx for the contribution, it is working fine but the limit is when a SharePoint user changes the title.

    Have you seen another solution to do the work ?

    ReplyDelete
  3. Just want to say your article is as surprising.
    The clearness to your publish is simply excellent
    and i could assume you are knowledgeable on this subject.
    Fine with your permission allow me to grasp your feed to stay up
    to date with imminent post. Thank you 1,000,000 and please keep
    up the gratifying work.

    My page - Ways to get gone moobs withinside Thirty days

    ReplyDelete
  4. I am really loving the theme/design of your web site. Do you
    ever run into any internet browser compatibility issues?
    A small number of my blog readers have complained about my website
    not operating correctly in Explorer but looks great in
    Safari. Do you have any suggestions to help fix this problem?


    Feel free to visit my blog chestfatburner.com

    ReplyDelete
  5. This article is genuinely a nice one it helps new web people, who are
    wishing in favor of blogging.

    Feel free to surf to my web page - chestfatburner.com

    ReplyDelete
  6. magnificent points altogether, you simply received a new reader.

    What could you suggest in regards to your put up that you made
    a few days in the past? Any sure?

    Feel free to visit my homepage Gynecomastia in age of teenage life and later Years

    ReplyDelete
  7. Do you have a spam issue on this website; I also am a blogger, and I was wondering your situation; we have developed some nice practices and we are
    looking to swap strategies with others, why not
    shoot me an e-mail if interested.

    Also visit my homepage - chestfatburner.com

    ReplyDelete
  8. Hi, if you are interested in solution for SharePoint 2013, I found this works for me:
    this.Style.Add(HtmlTextWriterStyle.Overflow, "hidden");
    where this is current web part, I work with SharePoint 2013 visual web part.

    ReplyDelete
  9. And then I work my way around and I say it when I home improvement
    designs speak-- that I'm connected to this and
    I'm sure everybody in this room connects to what comes out of my private practice.
    Published by Antique Collectors' Club, the book is available from the moment
    that you boot up your Samsung Galaxy home improvement designs SII mobile phone for the first time.
    They have small, immediate financial needs.

    Also visit my blog Osceola Fence Supply

    ReplyDelete

Post a Comment

Popular posts from this blog

Tab Control in Asp.Net

Scenerio: I need your help in designing tab control in   asp.net .My requirement is I need a tab control in   asp.net (C#) like  for example goto my computer ,right click c drive and select properties.we get tabs like general,security etc....... like that i need to design one tab control(no need of any rightclick) in my web page and the database table columns should come as tabs and inseide the tab data of that particular column should come.   Example:Employee master tab1:Employee name.........his name in the tab tab2:Age.............his age tab3:Address........his address   Solution:   You can do this using a simple div <style type="text/css"> .tabs         {             position: relative;             height: 20px;             margin: 0;   ...

AI and Microsoft: Revolutionizing Efficiency in Nonprofit Organizations

  How AI and Microsoft Enhance Efficiency in Nonprofit Organizations In today’s fast-paced world, nonprofit organizations face unique challenges—limited resources, increasing demands, and the constant need to do more with less. But what if technology could be the game-changer they need? In my latest research paper,  "How AI and Microsoft Enhance Efficiency in Nonprofit Organizations" , I explore how cutting-edge technologies like Artificial Intelligence (AI) and Microsoft’s innovative tools are revolutionizing the way nonprofits operate. From streamlining administrative tasks to enhancing donor engagement and optimizing resource allocation, AI and Microsoft’s solutions are empowering nonprofits to focus on what truly matters—their mission. This paper dives deep into real-world examples, practical applications, and the transformative potential of these technologies. Whether you’re a nonprofit professional, a tech enthusiast, or simply curious about the intersection of technolo...

Social tagging overview in Sharepoint 2010

A tag is a word or phrase that identifies an individual piece of information according to a set of attributes or criteria. Tags make it easy to find and share information about a specific subject or task. Social tagging helps users categorize information in ways that are meaningful to them. Social tagging can improve the quality of search results by filtering against specific tags, and it can also connect individuals who want to share information with other users who have like interests. This article describes the social tagging features in Microsoft SharePoint Server 2010. This article does not describe how to configure social tagging features. It also does not discuss how to implement social tagging features as part of an overall social media strategy for an enterprise. About using social tagging features Social tagging features help users to share information and to retrieve relevant, high-quality content more efficiently. Such sharing encourages collaboration and b...