Re: Problem for filtering a list

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Mike Walsh (englantilainen_at_hotmail.com)
Date: 01/12/05


Date: Wed, 12 Jan 2005 08:14:00 +0200

Please do not post questions on writing or amending web parts (even as an
additional newsgroup) to the main WSS newsgroup.

These questions are precisely what the .development newsgroup has been
created for.

Let's keep these things separate to the benefit of all.

[I would also suggest that you make your mind up whether this is a WSS
problem or a SPS 2003 problem and then send to only ONE development
newsgroup too]

Follow-ups to the WSS development newsgroup.

Will people responding to the original post please remove the main WSS
newsgroup from the list of newsgroups.

Thanks.

Mike Walsh, Helsinki, Finland
WSS FAQ at http://wss.collutions.com
Please post questions to the newsgroup only.

"Eric" <eric.holtzmann_nospam@capgemini.nospam.com> wrote in message
news:efvEUV%239EHA.2996@TK2MSFTNGP10.phx.gbl...
> Hi all,
>
> I have a list named Permissions in an area QuickLinks located under
the
> HomeArea.
> This list contains at least 3 columns (LinkTitle, Country, Groups)
> There are 2 rows in this list :
> LinkTitle Country Groups
> 1 Worldwide SPS_WW
> 2 Local France SPS_FR
>
> I want to select a precise row of my list, so I have written the following
> Webpart :
> using System;
> using System.ComponentModel;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Xml.Serialization;
> using Microsoft.SharePoint;
> using Microsoft.SharePoint.Utilities;
> using Microsoft.SharePoint.WebPartPages;
>
> using System.Drawing;
> using Microsoft.SharePoint.Portal.UserProfiles;
> using Microsoft.SharePoint.Portal.SiteData;
> using System.Data;
> using System.Collections.Specialized;
> using System.Security.Principal;
> using Microsoft.SharePoint.Portal;
>
> namespace MyWebParts
> {
> /// <summary>
> /// Description for OutlookMyContacts.
> /// </summary>
> [DefaultProperty("Text"),
> ToolboxData("<{0}:OutlookMyContacts
> runat=server></{0}:OutlookMyContacts>"),
> XmlRoot(Namespace="MyWebParts")]
> public class OutlookMyContacts :
Microsoft.SharePoint.WebPartPages.WebPart
> {
> private const string defaultText = "";
>
> private string text = defaultText;
>
> [Browsable(true),
> Category("Miscellaneous"),
> DefaultValue(defaultText),
> WebPartStorage(Storage.Personal),
> FriendlyName("Text"),
> Description("Text Property")]
> public string Text
> {
> get
> {
> return text;
> }
>
> set
> {
> text = value;
> }
> }
>
>
> /// <summary>
> /// Render this Web Part to the output parameter specified.
> /// </summary>
> /// <param name="output"> The HTML writer to write out to </param>
> protected override void RenderWebPart(HtmlTextWriter output)
> {
> Label lbl = new Label();
> string retour = "";
> SPQuery EqQuery = new SPQuery();
> EqQuery.Query = "<Where><Eq><FieldRef Name='Country'></FieldRef><Value
> Type='Text'>France</Value></Eq></Where>";
>
> PortalContext myPortalContext = PortalApplication.GetContext(Context);
> //get homeArea object
> Area HomeArea = AreaManager.GetArea(myPortalContext,
> AreaManager.GetSystemAreaGuid(myPortalContext, SystemArea.Home));
> SPList oList = HomeArea.Areas["QuickLinks"].Web.Lists["Permissions"];
> SPListItemCollection splc = oList.GetItems(EqQuery) ;
>
> lbl.Text = "nb lignes dans la liste Permissions : " + splc.Count;
> lbl.Text += "condition : " + EqQuery.Query;
> foreach(SPListItem li in splc)
> lbl.Text += "<br>" + li["LinkTitle"].ToString() + " => " +
> li["Groups"].ToString();
> if (splc.List.ItemCount == 1)
> retour = splc.List.Items[0]["Groups"].ToString();
> else
> retour = "";
>
> output.Write(SPEncode.HtmlEncode(retour));
> lbl.RenderControl(output);
> }
> }
> }
>
>
> When I run this whatever is the query I always get all the rows of my
> list!!!!
>
> If some of you could help me, I'm getting mad with this problem!!!
>
> Thanks
> Eric.
>
>



Relevant Pages

  • Re: Why cant i add "using System.Data.SqlClient" to a web part project using web part temp
    ... This is the newsgroup for SharePoint Team Services (STS). ... Please post questions on them (and other WSS questions) to the Windows ...
    (microsoft.public.sharepoint.teamservices)
  • RE: WSS 3.0 - WSUS and default web site issue in R2
    ... I ve stoped WSS 3.0 and use Configuration Wizard to do the job properly. ... Please open IIS manager, extend Web Sites, select the new web site ... Microsoft CSS Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.windows.server.sbs)
  • Re: SSL for SharePoint errors
    ... This is a Sharepoint document library access issue. ... it is better for you to repost it to WSS newsgroup for further ... |> After you success run CEICW to create self-signed certificate for SBS, ...
    (microsoft.public.windows.server.sbs)
  • Re: WSS from Project Server
    ... According to the stats from February, this newsgroup had more postings than ... Project Server 2003; SPS 2003 (and with specific functions that only those ... > WSS is good at, as many Microsoft products ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: An error occurred while retrieving the list of Databases
    ... The policy of this newsgroup is as I stated it and for the reasons I stated ... There's only a point to having WSS and SPS ... >>| am connecting to a Windows 2003 Server running Windows SharePoint ...
    (microsoft.public.sharepoint.windowsservices)