Hi guys.
I am in similar type of situation. I have couple of groups who I dont want to show any link and My whole project is stuck at this. I have tried your codes and they worked fine beside when I drag and drop the web part on the page it give me an error, " Problem with the Web Page might prevent it from Displaying or function properly.......
Line:226
Char:1
Error:Object Required
Code :0
URL:
"
just to let you know when I added the web part to portal main page it didnt give any error. I am also pasting my codes here. Please help i will really appriciate this help
do I have to install it in any particular way.? many thank in return
Imports System
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Xml.Serialization
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Utilities
Imports Microsoft.SharePoint.WebPartPages
Imports System.Text
Imports Microsoft.SharePoint.WebControls
'Description for WebPart1.
<DefaultProperty("Text"), ToolboxData("<{0}:WebPart1 runat=server></{0}:WebPart1>"), XmlRoot(Namespace:="Visible ")> _
Public Class Empview
Inherits Microsoft.SharePoint.WebPartPages.WebPart
'Private Const _defaultText As String = ""
'Private SiteCollection As SPSite = SPControl.GetContextSite(Context)
'Private SiteCollection As SPWeb = SPControl.GetContextWebWeb(Context)
Protected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter)
'Dim _text As String = _defaultText
Dim sbText As StringBuilder = New StringBuilder
Dim SiteCollection As SPSite
Dim Web As SPWeb
'Dim SPWeb As SPControl.GetContextSite(Context)
'Dim SPControl As
'SiteCollection = New SPSite("<
SiteCollection = SPControl.GetContextSite(Context)
Try
Web = SPControl.GetContextWeb(Context)
SiteCollection.CatchAccessDeniedException = False
sbText.Append("<table width='100%' border='0' cellspacing='0' cellpadding='0'>")
If Web.Permissions.DoesUserHavePermissions(SPRights.ManageWeb) Then
sbText.Append("<tr><td><hr></td></tr>")
sbText.Append("<tr><td><a href='_layouts/1033/settings.aspx'>Site-Settings</a></td></tr>")
sbText.Append("<tr><td><a href='_layouts/1033/create.aspx'>Create</a></td></tr>")
sbText.Append("<tr><td><a href='_layouts/1033/viewlsts.aspx'>Documents and Lists</a></td></tr>")
sbText.Append("<tr><td><a href='javascript:HelpWindowKey(%22NavBarHelpHome%22)'>Help</a></td></tr>")
End If
sbText.Append("</table>")
If Web.Permissions.DoesUserHavePermissions(SPRights.ManageWeb) Then
sbText.Append("<script type='text/javascript'>")
sbText.Append("document.getElementById('hidediv').style.visibility = 'visible';")
sbText.Append("</script>")
End If
output.Write(sbText.ToString)
Catch ex As Exception
output.Write("Ex: " & ex.Message + "<br>" + ex.StackTrace)
Finally
End Try
'Try
'Catch ex2 As Exception
' output.Write("Ex2: " & ex2.Message + "<br>" + ex2.StackTrace)
'Finally
'End Try
End Sub
' Public Overrides Function ShouldSerializeAllowZoneChange() As Boolean
'End Function
End Class