I'm learning how to develop webparts in SharePoint 2010.
What I'm having difficulty finding is how to allow the user to change the DataSource of the WebPart in the UI. I want to allow them to pick a list from the site, preferably of a specific type but one thing at a time.
Is there a specific control to do this or are you just supposed to expose a property of the webpart so the user can alter it?
There must be information on this out there but I'm having trouble finding it.
Does anybody have any good links on this subject?
Craig,
Using Web Part Property you can change DataSource from Edit mode and save it.
For custom webpart property click here.
Let me know if u have any query.
It sounds like it is the Content Query Web Part you are looking for.
This sounds like a great place to start reading:
"How to: Customize the SharePoint Content By Query Web Part by Using Custom Properties (ECM)": http://msdn.microsoft.com/en-us/library/aa981241.aspx
Good luck!
Related
I was wondering if anyone knows what a simplest way to create a data entry form in Sharepoint 2010 Foundation would be. Basicly I am looking to create a form that will submit its data to a custom list on the site, I don't want the users to interact with the list directly but use the form to enter data instead.
Also I can't use Designer or InfoPath, not being able to use these is what is causing the problem it seems. Just curious if anyone else has done something like this or could point me in the right direction.
Thanks
Every list is born with forms by default - one for item creation, one for edition and one for displaying. If you use content types, then you get a trio of these for each different type.
You never interact with the list directly, you do it through these forms. If you can't use either Infopath nor Sharepoint Designer, you can still edit them by clicking on the Page tab, then the Edit Page button. From there you can add or remove web parts, and connect them among themselves.
However, the amount of control you have is too limited when compared to editing pages through either of the tools or mentioned, or Visual Studio. For example, there is no straightforward way to add or remove list fields based on content type. Be prepared for ever increasing frustration if you can't use those tools.
I am new to Visual Basic and trying to get around in developing a good gui for a chat interface. I can understand the language as i have been using php and java from quite sometime.
Requirement
Basically i am trying to develop a interface which will show a list of users and along with that display a status (online/offline). My users will reside in mysql database. On clicking the user i want some actions to happen.
Question
I see there is datagrid, listview,listbox but not sure which one to use. Also is it a good idea to display the users by directly quering the mysql database or by accessing a php script which runs few queries and gives the data?
The ListBox control would not be a great option since it doesn't easily support multiple columns. The ListView control in Details view is a great option. I think it looks and works nicer than a DataGrid, but it doesn't natively support multi-line items. If you need multi-line items, the DataGrid control may be your best choice. Another option, which would give you more flexibility, would be to use a LayoutPanel control to display a vertical list of your own UserControl. You could design the UserControl anyway you want meaning you could fully control the size, look, and layout of each item in the list without being constrained by the list control.
As far as getting the data, that depends. If the database is always on the LAN and performance is important, then each client should go directly to the database. Otherwise, getting the data from a php script, web service, or WCF service would be a much better choice.
Rather than using the TableLayoutPanel, I would recommend using the FlowLayoutPanel with the FlowDirection property to TopDown and the AutoScroll property set to True. Then, to add a control dynamically, you could do something like this:
Dim item As New MyUserControl()
' Set properties of user control
FlowLayouPanel1.Controls.Add(item)
I have a list, and want to insert custom javascript code in a new form for this list (when form loaded). For example, when new form for this list is opened, I want to make some layout modifications for this form.
How it can be done? And how many ways exist to achieve this?
Thanks.
Upd: I ask about SharePoint list, and SharePoint list forms, I suppose you look at the tags of the question :).
You put tags for both SharePoint 2007 and 2010 and the methods are a bit different.
I agree with the previous post that with SP2010 you can simply use InfoPath designer for form design and do whatever you like to the look.
In SharePoint 2007, there are a couple ways incuding using SharePoint Designer, editing the form .aspx file, hiding the out of the box form and inserting a custom form which you will then be able to edit. You can also add in JavaScript code there as well.
My preferred method if you are just making some visual modifications is always JQuery which you can add in to a content editor and you can look for the particular tags surrounding rows or columns and attach to them and make your changes.
I think your question and tags need further clarification to get an articulate answer from anyone that will actually help you.
You can edit the layout using InfoPath 2010 like described here:
http://office.microsoft.com/en-us/sharepoint-designer-help/edit-list-forms-using-infopath-2010-in-sharepoint-designer-HA101631624.aspx
If you've got the SP2010 Foundation or SP2007 version, you can create custom list forms using SP Designer which gives you the option to do whatever you like since those are .aspx files.
http://office.microsoft.com/en-us/sharepoint-designer-help/create-a-custom-list-form-HA010119111.aspx
You can also edit the aspx List form in SP designer. To add Javascript or jQuery you should create a form for New in PS design then edit in Advanced mode to insert your Javascript in the proper place. There are many tutorials on the Web that talk about this... Also, you can add content editor webparts to the new aspx page where you can insert your Javascript or jQuery.
I am using the SharePoint client-object model to read data from a list and I was finally able to correctly get the data but now I am having difficulty actually displaying that data. I would like to use a dataform control to both add and edit the SharePoint list but am thus far unable to get it to actually display the items in the list. If anyone knows how to connect a Dataform control to a sharepoint list I would be very thankful.
You have to bind your list to the control. Have a look at the following page: http://dotnetslackers.com/articles/silverlight/The-DataForm-Control-in-Silverlight-3-Revisited.aspx section "Data binding" explains the steps you need to make (setting the DataContext property).
Are SharePoint 2010 Designer List Forms portable or custom rendering templates still the best way to customize the List Forms? InfoPath 2010 is out of question because of enterprise licensing issues.
Regards,
Nitin
It depends on the extent of your customization. You can achieve quiate a lot with the standard DataFromWebPart and custom XSLT but if you want to add custom controls you'll run into problems (as highlighted here http://www.chaholl.com/archive/2010/01/26/extending-the-dataform-web-part-to-allow-custom-field-controls.aspx).
For extensive customization the best bet is to create a custom webpart and include it on the edit form. Bear in mind that field controls automatically pick up and update content from the SPContext object so calling SPContext.Current.Listitem.Update() is enough to save the values of all field controls in your custom webpart. Of course if you're using standard asp.net control on there as well you'll need to pickup and set their values manually.