Is there a control that I can use to display document results similar to the ootb document listing?
-
יום שישי 27 אפריל 2012 17:33
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.
- נערך על-ידי Mohamad Sariman יום שישי 27 אפריל 2012 17:33
כל התגובות
-
יום שישי 27 אפריל 2012 17:37משיב
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/
- סומן כתשובה על-ידי Shimin Huang יום שישי 11 מאי 2012 08:30
-
יום שישי 27 אפריל 2012 18:10
You can use ListViewByQuery control!
Also there are similar controls: SPGridView and ListView.
Don't happy, be worry...
- סומן כתשובה על-ידי Shimin Huang יום שישי 11 מאי 2012 08:30
-
יום שישי 27 אפריל 2012 23:04
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.
-
שבת 28 אפריל 2012 00:22
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.
-
שבת 28 אפריל 2012 06:33משיב
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.
- סומן כתשובה על-ידי Shimin Huang יום שישי 11 מאי 2012 08:30
-
יום שני 30 אפריל 2012 21:04
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.
-
יום שני 07 מאי 2012 08:34משיב
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?
- סומן כתשובה על-ידי Shimin Huang יום שישי 11 מאי 2012 08:30