I need a control which simply outputs a list of items. Much like the summary link control but without the links. I thought about using the summary link control and use xsl to style the list, but the link field is required. So this is no good.
Is there anything?
Have you checked out the Content Query Web Part or the Content Editor Web Part?
Related
I'm trying to understand how to add a separator or header in list webpart from sharepoint (I think running 2013 version)
I got this :
And I want a "separator " like communities or other links :
I haven't access to sharepoint designer :(
It's a list webpart, but if I need to go on content editor to add some HTML code why not.
I have tried to use the 'group' function but it's really ugly
You could custom SharePoint list view by CSR.
Check here for CSR guideline
One thread for your reference.
Please excuse if there is a better way to do this, I'm not too familiar with SharePoint web parts, I'm only just now getting into creating them.
What I want to do is have a web part that I can drop into a page, give it a parameter, and then the web part does it's API calls with said parameter, does some XSL transformation, and spits out the HTML that I want to display on the page. In my mind it seems like a simple little web part to write, I just want to make sure this is the best way to go about it and not be duplicating something that could already be existing.
I've gone through this creating a basic web part walkthrough, and I figure I can use the web part property to get the parameter from the user. How would I get it to output HTML though? I changed the "Hello, world!" text to output some HTML and it seemed to have gotten stripped out?
Thanks a ton, and sorry if anything seems noob-ish!
From what I see, there are two main parts to what you want to do.
Get your parameter into your query
Format the results with some HTML
Reuse it later
There are a lot of ways to do this, but I'm going to outline what I believe to be the fastest and most simple.
Getting your parameter into your query
In SharePoint 2010, SharePoint designer has some great options for this.
So step 1 is to open the webpage in SharePoint Designer.
Click the Insert tab and click the Data View dropdown and select the list you want to get data from.
Now click on the Options tab and click on Parameters
The dialog shows you some of the options for pulling info into your query.
A query string parameter is easy to use. And the server variables are also really handy.
For our example, we'll pick query string and set the default value to 1 (which will be the ID of an item we want to be retrieved). Since we've set this as the default, even if the query string is blank we'll still get our default in our parameter.
Then click on Filter.
We set our Field Criteria to use the parameter we just made.
Now you can save the page in SharePoint Designer and test your results. Pretty fast.
Format the results with some HTML
In SharePoint, XSLT is the best way to put your own HTML around some data you've retrieved from SharePoint.
Also, for getting a parameter into your query, we can add that with a parameter binding:
If you're new to XSL, here's the best xsl tool:
http://spexp-blog-files.s3.amazonaws.com/blog/files/spe-magic-data-view-builder.xsl
To use the magic dataview builder, save this file to documetn library in your farm.
If you’d like to centralize your XSL template for greater reuse (highly recommended), you can put the individual XSL files into a central location for storage. In a WSS or SharePoint Foundation environment, I’d recommend using a Document Library in the root site of your Site Collection. In a MOSS or SharePoint Server 2010 environment, I’d recommend placing the XSL files in the /Style Library/XSL Style Sheets location, as this is where SharePoint stores its XSL by default.
Then paste the url to the file into the XSL Link to replace main.xsl and change Default to FALSE. This property is located near the end of the <XmlDefinition> tag as you view the webpart in Designer.
... <XslLink Default="TRUE">main.xsl</XslLink><Toolbar Type="Standard"/></View></XmlDefinition>
From there, you can save the page and the XSL wizard from magic data view builder will walk you through creating your own xsl to output your html.
Reusing Your Webpart
To reuse it, click save "To Site Gallery" while your cursor is on the wepart in SharePoint Designer. This will save the webpart into the gallery under the "Custom" group. From there, you an insert your webpart into other pages just like the out of the box webparts.
I think we need more information about what you are trying to get the web part to do. If you use a SharePoint Data View web part, you can point it at a data source, write some XSL to transform the data to render the way you want it will output the HTML to the page. For example, let's say I have a SharePoint list of training classes. I could create a data view web part that takes a query string or other input parameter as its filter, and filter the list of classes to show me just the one that matches the ID of my query string or input param. Then I could format my XSL to output details about the class rendered in whatever fancy HTML I want.
Does that help?
"I changed the "Hello, world!" text to output some HTML and it seemed
to have gotten stripped out?"
Please be aware that in your sample, it uses a LiteralControl() which by default HTML Escapes any text. So if you need HTML outputed via the LiteralControl.Text element, you will need to set the Mode to "Passthrough".
protected override void CreateChildControls()
{
base.CreateChildControls();
LiteralControl message = new LiteralControl();
// !! add this !!
message.Mode = LiteralMode.PassThrough;
message.Text = DisplayMessage; // <-- containing HTML
Controls.Add(message);
}
Sharepoint designer is not allowed. The forms must contain fields with references to list items but may contain custom asp controls as well, which we whish to use later in the process.
The target isn't always to replace the original new, edit and display forms but to create extra forms too. Currently, we create custom forms by copying the existing base forms and edit them by hidding the zonetemplates and add our custom fields below. It aint the most elegant way, but at the moment the best result we have so far.
I would like any suggestions.
If developer tools ar not allowed, you might want to consider Infopath.
Also, SharePoint comes with a Form Web Part that you could include in your page.
When you click on the name of a library, go to the documents tab, click on "upload document".
An upload form appears that is created using the dialog framework. The 1st choice on the form is content type.
I need to instead launch a custom infopath form that will allow me to dynamically populate a 2nd dropdown box on the page after the content type (still 1st) dropdown is populated.
I feel like I'm really grasping at straws here. At this point I could use a reference to a relevant section of a book, a link to a relevant post or even just the correct terms to put into a google search. What is the correct name for that form?
I found this which seems to teach you how to insert a customized aspx form: http://microsoftsharepointandbeyond.blogspot.com/2009/10/customizing-ootb-sharepoint-forms.html
But I'd really like one that uses Infopath instead.
Any advice or direction you can provide would be greatly appreciated.
I'm pretty sure doing this with infopath is not possible, the forms are bound to a (codebehind) class in the SharePoint object model, which handles the actual upload (add to list, set field values etc. etc.).
A custom aspx page would be possible though, exactly as the post you mentioned descibes. I agree with the post's author that an HttpModule would be best, because:
editing the OOTB upload.aspx in the 14 hive would make your environment unsupported (i.e. if anything brakes, MS will have you revert your farm to a supported state before they come and help you.
The next time you install an update for sharepoint, your changes could be overwritten.
I'm creating an archive of news articles in a sharepoint publishing site. users can browse or search the archive. browsing is a simple list of article dates titles. I'm using the DataFormWebPart to display the contents of the Pages (articles). as there are thousands of articles, i'l like to show maybe 50 on a page. I see no built in paging on the DataFormWebPart. I'm seeking guidance on the proper way to add paging. I'm feeling like the XSL template is the proper place to start.
If you look at the page using the sharepoint designer in 'design' mode, you can click the common task arrow ( > ) and customize the data view properties.
One of the tabs will be about 'paging' and you can set how many items per page.
Hope this helps!
The XSL template is where you need to start. Unless you are dealing with multiple data sources setting a list as the datasource on a new DataFormWebPart in SharePoint Designer (SPD) will create an XSL template with paging (10 items default). You can then review and edit the XSL if you want to modify the appearance or operation. After the initial XSL template take a look at the webpart properties in either the browser or SPD. There are some other settings (e.g. async) that you may want to alter. The paging technically works with mutiple data sources but it is only on the parent data source. If the child count is large it often times is too large to see the paging control in SPD.