none
Is there a control that I can use to display document results similar to the ootb document listing?

    Pergunta

  • Anyone,

       I'm doing a query against a document library using a webpart and I need to display my results similar to the document listing like the ootb feature with sorting and hyperlinks set. Is there any controls available or I have to build them from scratch?

    Can someone help me with this?

    Thanks


    M Sariman RKO Business Solutions Inc.


    sexta-feira, 27 de abril de 2012 17:33

Respostas

Todas as Respostas

  • Hello,

    I don't think the is an oob feature to do this but you can use the oob listviewwebpart in your custom webpart and change the query before displaying it!

    I've made a topic about that here : http://christopherclementen.wordpress.com/2012/04/02/filter-a-list-dynamically/

    Hope this help!


    Best regards, Christopher.
    Blog | Mail

    • Marcado como Resposta Shimin Huang sexta-feira, 11 de maio de 2012 08:30
    sexta-feira, 27 de abril de 2012 17:37
    Usuário que responde
  • You can use ListViewByQuery control!

    Also there are similar controls: SPGridView and ListView.


    Don't happy, be worry...

    • Marcado como Resposta Shimin Huang sexta-feira, 11 de maio de 2012 08:30
    sexta-feira, 27 de abril de 2012 18:10
  • Can I use it for multiple library query like the

    SPSiteDataQuery spQuery = new SPSiteDataQuery();
    spQuery.Webs = "<Webs Scope=\"SiteCollection\">";

    .......
    spQuery.Lists = "<Lists>
                                   <List>......</List> <List>......</List>
                            <Lists>";

    ............................


    M Sariman RKO Business Solutions Inc.

    sexta-feira, 27 de abril de 2012 23:04
  • Thanks Chris,

    ***************************************************

    1)  I got the grid displayed using your method but I'm getting errors when hovering on the list, pointing me to this when I debug

    function anonymous() {
         setupFilterMenuContext(ctx1);
    }

    or

    function anonymous() {
    setupMenuContextName('ctx1');
    }


                SPSite site = new SPSite(SPContext.Current.Web.Url);
                ListViewWebPart wp = new ListViewWebPart();
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Reference Documents"];
                    ListViewWebPart lvwp = new ListViewWebPart();
                    lvwp.ListName = list.ID.ToString("B").ToUpper();
                    lvwp.ViewGuid = list.DefaultView.ID.ToString("B").ToUpper();

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(lvwp.ListViewXml);
                    XmlNode queryNode = doc.SelectSingleNode("//Query");
                    XmlNode whereNode = queryNode.SelectSingleNode("Where");
                    if (whereNode != null) queryNode.RemoveChild(whereNode);
                    XmlNode newNode = doc.CreateNode(XmlNodeType.Element, "Where", String.Empty);
                    newNode.InnerXml = query.ToString();
                    queryNode.AppendChild(newNode);
                    lvwp.ListViewXml = doc.OuterXml;

                    pnlResults.Controls.Add(lvwp);
                }

    Do I need to do anything else here?

    ***************************************************

    2) This will only work with one list only right?
        My requirements is to use SPSiteDataQuery where the query can search more than one document library.

    Thanks


    M Sariman RKO Business Solutions Inc.

    sábado, 28 de abril de 2012 00:22
  • 1) What kind of error have you? have you some message?

    2) yes it's working only with one list . 

    maybe you can investigate this topic : http://code.msdn.microsoft.com/sharepoint/Ejemplos-sobre-cmo-usar-el-69cd5f16

    It's seem to be what you are looking for.

    Hope this help!


    Best regards, Christopher.
    Blog | Mail

    • Marcado como Resposta Shimin Huang sexta-feira, 11 de maio de 2012 08:30
    sábado, 28 de abril de 2012 06:33
    Usuário que responde
  • By the way,

      How do I fix this issue.
    When I display without intercepting the  whereNode I got all the records displayed.
    But when I started to intercept the query I'm getting this error.

    "One or more field types are not installed properly. Go to the list settings page to delete these fields".

    *********************************

               string query = GenerateCAMLQueryText();
              // this generates - <Where>
                                             <Or>
                                                <Eq>
                                                    <FieldRef Name=\"FBCKbWorkProcess\" LookupId=\"TRUE\" />
                                                    <Value Type=\"Lookup\">12</Value></Eq><Eq>
                                                    <FieldRef Name=\"FBCKbWorkProcess\" LookupId=\"TRUE\" />
                                                   <Value Type=\"Lookup\">21</Value>
                                                </Eq>
                                            </Or>
                                         </Where>
                

                SPSite site = new SPSite(SPContext.Current.Web.Url);
                ListViewWebPart wp = new ListViewWebPart();
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Reference Documents"];
                    ListViewWebPart1.ListName = list.ID.ToString("B").ToUpper();
                    ListViewWebPart1.ViewGuid = list.DefaultView.ID.ToString("B").ToUpper();

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(ListViewWebPart1.ListViewXml);
                    XmlNode queryNode = doc.SelectSingleNode("//Query");
                    XmlNode whereNode = queryNode.SelectSingleNode("Where");
                    if (whereNode != null) queryNode.RemoveChild(whereNode);
                    XmlNode newNode = doc.CreateNode(XmlNodeType.Element, "Where", String.Empty);

                    newNode.InnerXml = query.ToString();
                    queryNode.AppendChild(newNode);
                    ListViewWebPart1.ListViewXml = doc.OuterXml;
                    ListViewWebPart1.Visible = true;
                
                }


    M Sariman RKO Business Solutions Inc.

    segunda-feira, 30 de abril de 2012 21:04
  • sorry for the delay, I didn't seen your response..

    the error : "One or more field types are not installed properly. Go to the list settings page to delete these fields".  is often cause by the name of the field you try to query .

    are you sure that the field name  FBCKbWorkProcess is correct?

     


    Best regards, Christopher.
    Blog | Mail

    • Marcado como Resposta Shimin Huang sexta-feira, 11 de maio de 2012 08:30
    segunda-feira, 7 de maio de 2012 08:34
    Usuário que responde