.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Hide an webpart whit no active info

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :SharePoint

Is it possible to hide a webpart that has no active content and when there is an active entry, make it visible again?


View Complete Post

More Related Resource Links

Changes in Active Directory not reflected in SharePoint user info



I have a client who uses WSS 3.0 w/ SP1, and does not want to move to MOSS 2007.  The client will be migrating to Exchange 2007 soon, and part of this migration will include populating attributes for the user objects in Active Directory so that the phone numbers, addresses, departments, etc are all stored in AD.  The problem is that the mojority of the user base has already used SharePoint, and when each user first used SharePoint, their info was imported from AD.  Is there a way to force an import so that all the user info in SharePoint will be updated based on what is in Active Directory?  Is it possible to do it in the reverse direction so that users can update their info in SharePoint, and have it write back to their AD user object?


-Derek Brown

Sr System Engineer



How to hide ribbon buttons in a publishing webpart page?



I'm trying to hide some ribbon buttons from a publishing web part page(a page thats url ends with: /pages/default.aspx), and i just can't seem to do it.

I created a feature with custom actions to hide the buttons but it doesn't work for publishing web part pages.

Can someone give me a working example on how to hide the Make Homepage button from a webpartpage?

Here is the code i used that's currently not working, in 3 different formats, neither of them works for me:


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

hide webpart if screen size lower than 1280

Hello all,

I am using a webpart zone control and I need to set it to visible if the screen resolution of the user is nore then 1280 pixels.

How do I do that?


Update Webpart Assembly info programmatically



We have a requirement where in we need to update all the old custom webpart which are added to the portal with new Assembly information. The way we have planned is to create a console app, iterate through all the Pages Library withing each Site and Sub-site, get the WebPart Collection and once the "SPWebpartCollection" object is created, use System.Reflection.PropertyInfo and get all the property. I am done almost uptill here, but now stuck on how to proceed further. I would like to change the WebPart Assembly and Namespace information. The reason why this is required is, earlier earlier each webparts were having different dll. Now we have clubed all the webpart under one Assembly and the namespace are kept same now. But because the webpart were added to the page manually, they are holding the reference to the old assembly. The other way would be to remove the webpart and re-add the webpart which is not very much accepted when the number of sites and sub-sites involved in more than 1500.

Any solution would be really appreciated. Thanks.

Regards, Paddy

Hide a repeater in ASP.NET C# if the DataSource contains no items?

I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It's to the effect of the following:
In the (C#) code-behind I'm basically using LINQ to pull a listing of information from an XML document and bind that information to the first repeater.

Searching for the answer to this, it seems the method is to determine whether the data for the nested repeater is empty. If it is, then you set the visibility of the repeater to false.

Like Celebrities - info about all celebrities

Like Celebrities - info about all celebrities

Automatically redirect to HTTPS and check if SSL is active



I've set in the web.config:

    <!-- User Authentication -->
    <authentication mode="Forms">
      <forms loginUrl="~/Page/View/Content/Login.aspx" timeout="2880" requireSSL="true" />

This works fine. If there is no ssl connection, the login form doesn't continue. But I would like to check if ssl is active (in codebehind) and, if it's possible, to automatically the user to the https page if he's currently on http. (I could do this job by manually redirect with page.response("https://url.../login.aspx"); but this is not really generic. For example if the webapp is moved to another domain it doesn't work anymore... I'm looking for something like: FormsAuthentication.RedirectWithSSL(); or so... :D)


How to set SearchRoot Path in Active Directory in this scenario


How to set SearchRoot Path in Active Directory in this scenario:

Functionality: We have scenario that 1<sup>st</sup> hit one LDAP server with some 'fixed user name' &' fixed password ' and filter data with specific User name(which given by user) getting 'User dn'.

After that we hit Next LDAP server based on the 'User dn' getting from 1<sup>st</sup> server.

(So, in my case 1<sup>st</sup> LDAP server works like as Load balancing server but functionalitywise it is different)


active directory exception unusual behaviour


i have a small problem
i want user names from active directory for an auto completer type of service
the method is always throwing an exception 
"searcher.FindAll()' threw an exception of type 'System.DirectoryServices.DirectoryServicesCOMException' System.DirectoryServices.SearchResultCollection 

Active Directory and .NET: paging the search result

Hi everybody!

I have a question about Active Directory in .NET
For my project I need to fetch results from Active Directory search page by page, because later I would need to bind it to the pageable DataGrid.

I tried to use .NET library DirectoryServices for that, but paging provided by this library is transparent to the user and is used only to increase the efficiency of searching, when results are too big. I.e. I cannot tell the DirectorySearcher to give me first page, then the next or previous page, it returns me all resulting pages in one bundle.

However, what I need is to explicitely get page after page directly from the AD searcher and to be able to go at least one page forward or backward.

The solution with copying all results to the DataBase and then do the paging is not accepeted by the clent, since it is too inefficient. And since it's a Web app, I cannot keep results in memory either.

I found some hints about COM Interface, but I could not find good and detailed examples or explanations. I aslo found this line of code: DirectoryServices.Interop.IDirectorySearch.ExecuteSearch(), but I don't know which libraries should i add to be able to compile this code.

If somebody could help me out with that problem, any suggestion is welcome, 'cause this issue is eating me alive :)

Thank you!

Error on Display user's fullname using Active Directory in asp.net using vb.net



wi As System.Security.Principal.WindowsIdentity =  _System.Security.Principal.WindowsIdentity.GetCurrent()



Dim a As String() = HttpContext.Current.User.

Getting list of users reporting from specific Manager from Active Directory


Dear All,

I am have requirement like displaying all the user information reporting to specific manager from Active Directory.

Please help me regarding this.



Problem with changing language using culture info


I'm using the following msdn article to use different languages in my web application:


I'm following the instructions step by step in VS 2010, and it creates the resource files exactly how it's supposed to. 

However, when I run the program it just doesn't apply it. I don't see the different values from the resource file. 

If I leave my resource file name as sample.aspx.resx, it works. But when I change it to sample.aspx.en-us.resx, it doesn't work. I'm supplying culture from the aspx page's Culter and UICulture properties. I'm being very careful in choosing the correct file name, as that could be the issue,  but it just doesn't work. I also tried changing the culture in the backend code this way:

List Users from Active Directory


When i try to List the users from Active directory, i get this exception.

Error while processing.System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll()

The code i used is :

DirectoryEntry de = new DirectoryEntry(_path);
DirectorySearcher deSearch = new DirectorySearcher();

deSearch.SearchRoot =de;

deSearch.Filter = "(&(objectClass=user) (cn=" + UserName +"))";

SearchResultCollection results = deSearch.FindAll();

 But the DirectoyEntry method is getting validated if i use the overloaded method : DirectoryEntry(_path, domainAndUsername, password);

Please advice me.

AD FS 2.0 in Identity Solutions: Using Active Directory Federation Services 2.0 in Identity Solution


This article explains how you can use Active Directory Federation Services (AD FS) 2.0 to claims-enable Windows Communication Foundation (WCF) services and browser-based applications. The focus is on the token issuance functionality in AD FS 2.0. You'll find out how to use AD FS 2.0 as an identity provider; set up an AD FS 2.0 security token service (STS) to interact with WCF; federate AD FS 2.0 with your custom STS or another AD FS 2.0; enable Web single sign-on and federation with WS-Federation and SAML 2.0 protocols; and externalize authentication logic through Visual Studio. You'll come away appreciating how AD FS 2.0 and Windows Identity Foundation make programming identity solutions in Windows less of a chore.

Zulfiqar Ahmed

MSDN Magazine November 2009

Toolbox: The Active Record Pattern, Aspect-Oriented Programming


This month we look at implementing the Active Record Pattern in your .NET application and how aspect-oriented programming yields separation of concerns.

Scott Mitchell

MSDN Magazine February 2009

Security Briefs: Active Directory Cache Dependencies


If you're not taking advantage of Active Directory, you should be. Learn the benefits from Keith Brown.

Keith Brown

MSDN Magazine July 2007

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend