Is there a control that I can use to display document results similar to the ootb document listing?
-
2012年4月27日 下午 05: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 2012年4月27日 下午 05:33
所有回覆
-
2012年4月27日 下午 05: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 2012年5月11日 上午 08:30
-
2012年4月27日 下午 06:10
You can use ListViewByQuery control!
Also there are similar controls: SPGridView and ListView.
Don't happy, be worry...
- 已標示為解答 Shimin Huang 2012年5月11日 上午 08:30
-
2012年4月27日 下午 11: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.
-
2012年4月28日 上午 12: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.
-
2012年4月28日 上午 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 2012年5月11日 上午 08:30
-
2012年4月30日 下午 09: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.
-
2012年5月7日 上午 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 2012年5月11日 上午 08:30

