SharePoint Web Part: Hide OOB Editor Part Categories (e.g. Appearance, Layout) - sharepoint-2010

I am developing a custom web part for SharePoint 2010 wherein I need to hide the OOB editor part categories like Appearance, Layout etc..
I tried overriding the CreateEditorParts() method of the WebPart class and return an empty EditorPartCollection collection but this doesn’t seem to work.
Appreciate any pointers to achieve the same.

Related

Kendo-ui MVC PopUp editor: How to hide fields

I'm using Kendo ASP.NET MVC and I would like to have some control over the edit form.
Things I would like to do:
Hide my ID field
Change my Property Code and Square Feet to regular TextBoxFor fields
Change Date of Purchase and Date of Sale to Kendo DatePickerFor instead of the DateTimePickerFor that is showing.
Link to screenshot of editor form
When you click edit, Kendo uses the default EditorTemplate for the object. If you're not familiar how editor templates work, check this article.
You have two ways of solving it, either by creating a custom view editor templates that only lists the fields you want. Or (and this is simpler and preferred method), in many cases you can get away with the default editor template and control which fields are rendered (and how) using metadata on the object. You can hide individual properties by tagging them with [ScaffoldColumn(false)] attribute. In terms of controlling the types of editors that show up, you can accomplish this by tagging your properties with [DataType(DataType.Date)] or [DataType(DataType.Text)]

Insert javascript code in a list form.

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.

Navigation bar and Menu in sharepoint 2010

I have a custom Mega drop down Menu need to brand it on sharepoint 2010 am I obliged to override the specific CSS of sharepoint menu or there is another solution if there is anaother one how can i do it cause the menu that i need is so complicated. thanks in advance please guys some help is needed here :)
Drop downs in list forms (choice or lookup fields) can be customized using InfoPath designer. In Aspx pages, masterpages and web parts, the drop down lists are normal ASP.NET DropDownList controls and can be customized via css classes as usual.

SharePoint Designer 2010 List Forms

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.

Sharepoint form layout in VB

OKay, I'm from a PHP background, but I've just been tasked with developing some custom Web Parts in SharePoint. I've figured out how to create and deploy a basic "Hello world" web part in VB. Okay so far.
What I'm stuck on is a really basic, stupid point - how the hell do I lay out things in a VB web part?
For an example, here's a label and a textbox:
protected overrides sub createchildcontrols()
mybase.createchildcontrols
dim mylabel as new label
dim mytextbox as new textbox
mylabel.text ="My label text"
mytextbox.text ="My textbox"
me.controls.add(mylabel)
me.controls.add(mytextbox)
How would I, for example, get mylabel and my textbox to appear on different lines, rather than running one after the other as they do now? In PHP I'd just wrap them in some top break them onto differnt lines, but how do I do it here?
There are a number of ways to go about it. The easiest, if you really just want the controls to appear on different lines would be to add an ASP.net LiteralControl with a BR tag between them.
Aside from that, you can always use the ASP.net formatting controls, like Table to break your controls into sections for output.
Additionaly, everything that derives from WebControl has an Attribues and CssClass property for setting formatting based on style-sheets you can use.
The last method, and the most customizable, but hardest to maintain and change, would be to override the webpart's Render method and generate your HTML completely by hand in the WebPart.
Alternately, you could scrap this altogether, and employ the SmartPart to develop ASP.net user controls for use inside of SharePoint, giving you the options to use the Visual Studio designer tools to layout your controls on the form.
You should override the Render() method. By default this method just renders all the child controls you have added in the CreateChildControls() method, but overriding it lets you write additional HTML elements around the controls.
I usually code in C#, but I think the following example should work in VB:
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
writer.Write("<h1>Custom webpart rendering</h1>")
me.mylabel.RenderControl(writer)
writer.Write("<br />")
me.myTextbox.RenderControl(writer)
End Sub
Give it a try...
I've been developing web parts for an ASP.NET site using the standard web user control model, which gives you access to the VS designer and means your UI can be standard HTML. ASP.NET then wraps the UserControl into a GenericWebPart at runtime to host it in a WebParts site.
I know that Sharepoint doesn't support this model out of the box but I've just found this which might help you...
http://weblogs.asp.net/jan/archive/2006/12/02/announcing-the-return-of-the-smartpart.aspx
Smart Part (or a variation of it) is the easiest way to go. Why mess with rendering direct html when you can develop a user control more easily?
Plus if you are not an expert in VB, having Visual Studio Designer will help with creating user controls
i blogged about this very topic. Easily build a rich UI for a web part without using SmartPart
Thanks for all the responses. I've gone with EvilGoatBobs solution as the most immediately easy to implement.
This is my first time on StackOverflow and your helpful answers have made it a really good introduction to the site! :)