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

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

Getting tags and their counts for a given URL Base?

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :SharePoint
I'm fighting with the SocialTagManager since a few hours to get something incredibly simple done: For a given URL Base, give me all tags (from the Tags and Notes) and how often they are used, if the tags start with a certain string. So I have a Page http://myportal/SomePage.aspx that is called with an ID, like  http://myportal/SomePage.aspx?ID=1 http://myportal/SomePage.aspx?ID=2 etc. Each ID-Page can be tagged by users.   In SQL, this is trivial:   SELECT TOP 10 InputTermLabel, COUNT(InputTermLabel) AS Count FROM dbo.SocialTags WHERE InputTermLabel LIKE 'su%' AND UrlID IN ( SELECT UrlID FROM dbo.Urls WHERE Url like 'http://myportal/SomePage.aspx%') GROUP BY InputTermLabel ORDER BY Count DESC   I can't find a proper way to do this through the Object Model. My current approach is this:   public IDictionary<string, int> GetTags(string query) { var result = new Dictionary<string, int>(); using (var site = new SPSite(_siteId, SPUserToken.SystemAccount)) { var baseUrl = Config.GetSocialUrlBase(site.RootWeb); var stm = new SocialTagManager(SPServiceContext.GetContext(site)); var terms = stm.GetAllTerms(new Uri(baseUrl),0); foreach (var term in terms) { if (!term.Term.Name.StartsWith(query, StringComparison.InvariantCultureIgnoreCase)) continue; var tc = stm.GetUrls(term.Term); int usageCoun

View Complete Post

More Related Resource Links

How to change the default page base class?


I've tried setting the <pages pageBaseType="DynamicWebPage" /> value in web.config, but when I response.write out the page type, I'm still getting Microsoft.WebPages.WebPage.

I'm simply trying to sub-class WebPage and add some additional functionality such as a dynamic PageData dictionary similar to Phil Haack's dynamic ViewData dictionary.



Rendering data with HTML tags in the DD Gridview for a selected column


I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx.  As a simple case, suppose I have formatted cell data that is A<br/>B in the DB.    Obviously, I want A stacked on B in the cell.

It seems gridView1.HtmlEncode = true has gone away.

So maybe I'll try to catch it on the RowDataBound event:

protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)

            if (e.Row.RowType == DataControlRowType.DataRow)
                // Html Encode the cells


but this event never fires?

Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1? 

If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way.  Thanks!

Can I replace the EntityObject as base-class in Entity Designer 3.5 sp1?


I'm using EF3.5sp1 for a project, and I've been working around many of its problems... as such, my entity partial classes have a lot of logic in them for change-tracking and whatnot.  Obviously, I'd like to factor this logic out into a common base class, but of course all my objects must derive from EntityObject.  Is it possible to tell them to derive from some class of my own invention (which would actually likely derive from EntityObject themselves)?

I'd rather avoid editing the EDMX file unless the changes will be safe on entity-model-update, since I'm still making changes to the database schema in this early state of my project.


Also, is there any good workaround for the fact that the change isn't tracked when you change EntityReference.EntityKey?

Invalid length for a Base-64 char array for my coding in ASP.net C#. How to solve it ?


Hi Friends ,

I have done encrypted password and decode but i got error  like  this  " Invalid length for a Base-64 char array" .

Pls help . Thanks


psswd = txtPassword.Text;

pwed = base64Decode(psswd);

public string base64Decode(string sData)
            System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
            System.Text.Decoder utf8Decode = encoder.GetDecoder();
            byte[] todecode_byte = Convert.FromBase64String(sData);
            int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
            char[] decoded_char = new char[charCount];
            utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
            string result = new String(decoded_char); return result;

CLR Inside Out: What's New in the .NET Framework 4 Base Class Library


Just about everyone who uses Microsoft .NET uses the Base Class Libraries (BCL).When we make the BCL better, almost every managed developer benefits. This column will focus on the new additions to the BCL in .NET 4 beta 1.

Justin Van Patten

MSDN Magazine September 2009

CLR Inside Out: Base Class Library Performance Tips and Tricks


The common language runtime (CLR) sits at the very heart of managed code. Indeed, it is the heart of managed code, so to understand managed code you need to understand the CLR.

Kit George

MSDN Magazine January 2006

Smart Tags: Simplify UI Development with Custom Designer Actions in Visual Studio


Windows Forms 2.0 components expose smart tags by utilizing Designer Actions. By taking advantage of this feature, you can add smart tags to your own custom components to make setting their properties and other actions much easier and developer-friendly.

Michael Weinhardt

MSDN Magazine July 2005

Smart Tags: Realize the Potential of Office 2003 by Creating Smart Tags in Managed Code


While you may well be excited about the prospect of building managed smart tags, there is little information available to help you create them using .NET. In this article the author fills in the blanks. Along the way he discusses the Microsoft Office Smart Tag List XML schema, advanced managed smart tags for Office 2003 and Office XP, and deploying these features in an organization.

Ben Waldron

MSDN Magazine February 2005

Serial Comm: Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications


Out-of-the-box, the only way of coding RS232 serial communications applications in the .NET environment is to import the outdated and somewhat limited MSComm ActiveX control. This article describes the development of a lean, multithreaded, and modern RS232 base class library in C# managed code. The library uses Platform Invocation Services to interact with the Win32 API directly. Application programmers can use the library from any .NET language through inheritance; the article explores examples written in C# and Visual Basic .NET.

John Hind

MSDN Magazine October 2002

Windows Services: New Base Classes in .NET Make Writing a Windows Service Easy


Windows services are applications that run outside of any particular user context in Windows NT, Windows 2000, or Windows XP. The creation of services used to require expert coding skills and generally required C or C++. Visual Studio .NET now makes it easy for you to create a Windows service, whether you're writing code in C++, C#, or Visual Basic. You can also write a Windows service in any other language that targets the common language runtime. This article walks you through the creation of a useful Windows service, then demonstrates how to install, test, and debug the service.

Ken Getz

MSDN Magazine December 2001

change calendar date backColor base on data from db


I want to  change calendar date backColor base on data from db,  I only have vistual 2003 !

on mean time I have

<asp:DataGrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 23px; POSITION: absolute; TOP: 271px"
		    runat="server" Font-Size="XX-Small" Font-Names="Verdana" AutoGenerateColumns="False" Visible="False">
           <asp:BoundColumn DataField="subject" HeaderText="Title"></asp:BoundColumn>
           <asp:BoundColumn DataField="posttimestart" HeaderText="Post date"></asp:BoundColumn>


Sub DayRender(ByVal source As Object, ByVal e As DayRenderEventArgs)
        Dim i As Integer
        For i = 0 To DataGrid1.Items.Count - 1
            If (DataGrid1.Items(i).Cells(1).Text = e.Day.Date) Then
                e.Cell.BackColor = Color.DarkOrange

            End If

    End Sub

when I click the day wich have data in db it change  color , but I want the page load it change color !

Thank you!

Issue with List Definition of same base content type and deployed via same feature


I am trying to deploy two custom list definitions using only one single feature.  Below are the details of my issue.

  • Two custom list definitions
  • Each custom list definition has its own custom content type
  • Each custom content type inherits from the base content type Picture (Type = 109)
  • The custom list definitions are grouped together under one single feature
  • The custom content types are grouped together under a seperate single feature

When I deploy my solution in this configuration, the second list definition gets the first custom content type applied to it and the list schema from the first list definition is also applied to the second list definition.

What makes this more interesting, when I seperate both of the list definitions under two seperate features it all works fine.  Custom content types and list schemas get applied correctly.

Can anyone tell me why I can not deploy both list definitions under one single feature?

If you need me to post any of the origional code or XML to this post please let me know.



Web Service and Base Class Sub Routines



I have several Web Services that I call using jQuery, they are all <WebMethod()> _    Public Function and return either a boolean or string, depending on the function.

I have some Web Service functions, where I would like to call sub routines I have in my base class, they are Public Sub's.

When I add a call of a sub routine in the Web Service function, I get a blue line that says 'Object reference not set to an instance of an object'.  If I change the sub routine to Public Shared Sub, then the blue line and error go away, but I get other errors from the calls I was successfully making to the base class routines before.

Is there a way to get these two to work together?

"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not


I tried to convert a project from ASP.NET 1.1 to 2.0 and found one big problem which stops the whole process.

An .aspx page from the subfolder "admin" includes a user control from the subfolder "common". Both subfolders ("admin" and "common" are in the root).

- admin
-- aspx page
- common
-- user control

The page works well when started from Visual Studio, but when the project is precompiled for deployment, the next error occurs:

"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

I tried to use "Reference" in the .aspx page, but that doesn't work.

Does anybody know any workaround for this?

override of base class error please help!!!


i would really like to override http keepalives for my webservice and i found some source code that seems promising but i get an error that says

"function GetWebRequest" Cannot be declared override. 


    Protected Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest
        Dim webRequest = DirectCast(MyBase.GetWebRequest(uri), HttpWebRequest)
        webRequest.KeepAlive = False
        Return webRequest
    End Function

how do i implement this into my serivice and why im i getting this error??? in other words what in hell is the uri that i should be passing into this function.

Any assictance would be greatly appreciated.


Property of a base UserControl it's not handled correctly

Hello,I have a class that is a base class for my server controls. Inside this class I have a property that can take values from an enumeration.public enum PanelModeEnum { Add = 1, Edit = 2, ReadOnly = 3 } public class BaseControl : System.Web.UI.UserControl { #region Event Handling Management #endregion public PanelModeEnum PanelMode { get; set; } public virtual void ChangePanelMode(PanelModeEnum newMode) { this.PanelMode = newMode; } } I have then several user controls that inherits from this BaseControl and that I add into aspx pages declaratively<gsl:PhoneNumberUC ID="ucPhoneDetail" runat="server" PhoneNumberType="Home" />I would like to show one the derived BaseControl classes inside a ModalPopupExtender using server-side code. Before doing this I call the ChangePanelMode with a value from the PanelModeEnumucPhoneDetail.PhoneNumberType = ptype; ucPhoneDetail.ChangePanelMode(PanelModeEnum.Add); this.mpePopupPhone.Show(); But when, inside the inherited user control I check for the PanelMode property likeif (this.PanelMode == PanelModeEnum.Add) { ... } the value of this.PanelMode is always equal to zero. Why?Kindly regards
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