Custom Application Page

Nov 21, 2014 at 7:22 PM
Hi, I came across your tools and this looks to be very useful! However we are having some trouble getting the SPArrange to work on a custom SharePoint 2010 application page.

I saw some posting about adding xsl snippet for custom forms, however we do not have
<SharePoint:FormField>
Reference:
http://spservices.codeplex.com/wikipage?title=$().SPServices.SPArrangeChoices

We have a purely SharePoint application page and not modifying the newform.aspx, we replaced it with a new application page. We are adding the SPField controls dynamically so they are still SharePoint radio button controls. Any idea how we can get your tool to work in this scenario, will it work?

Thank you very much the tools look great and useful for future projects
Nov 21, 2014 at 7:27 PM
Would I need to add a new literal control (containing "<xsl:comment>FieldName="Gender"</xsl:comment>") before I add the basefield controls (SPChoice/ radio buttons) ?
Dec 1, 2014 at 3:30 AM
Hi, any idea on how to do this? Help would be appreciated thanks
Coordinator
Dec 1, 2014 at 4:20 AM
It sounds like you page is pretty customized. The value-added functions in SPServices are best used on the default forms. If you're making your own pages, then your markup is likely very different and the functions won't work. But if you're making your own page, you can control the layout yourself, right?

M.
Dec 1, 2014 at 4:36 AM
Hi, thanks so much for your reply. Yes the form is quite customized (using Visual Studio).

Basically it is adding SharePoint controls from the SPListItem programmatically, using BaseFieldControl
(something like this example http://www.codeproject.com/Articles/33489/Making-Use-of-the-SharePoint-Field-Type-Editing-Co)

So there is no '<SharePoint:FormField>' in the form to add the xsl comment to, and I tried adding it to the BaseFieldControl just before it is added itself such as this:

//Add the Edit control to the section panel
                ctrl.Controls.Add(new LiteralControl(String.Format("<xsl:comment>FieldName=\"{0}\"</xsl:comment>", field.InternalName)));
                ctrl.Controls.Add(cntrlEdit);
//cntrlEdit is the SP Control that is added dynamically (with a radio button list)

However it does not work and not sure if this will work in this scenario as the SPControls are added differently.

And so the problem also is that the control is in fact a SharePoint field control (RadioButtonChoiceField) and not a native asp.net control, so I cannot simply do RadioButtonList1.RepeatDirection = RepeatDirection.Horizontal.. There do not seem to be any properties for the RadioButtonChoiceField that allow us to change the direction in the code and I have had trouble setting this using CSS.

Also tried this javascript which did not work correctly http://social.technet.microsoft.com/wiki/contents/articles/18209.sharepoint-designer-2010-useful-tips.aspx.

I suppose perhaps this utility may not be able to help us here as it is meant for the OOTB forms, let me know iif you have any ideas on how this could work.

Thanks for your help and hopefully we can get it to work, otherwise either way you've made a great contribution here to all us SharePoint folks! (I will definitely come back here to use the tool for other projects, thanks!)

Chris
Coordinator
Dec 1, 2014 at 4:43 AM
Chris:

All the SPArrangeChoices function does is rearrange the DOM once the page loads.

It seems like you have two choices:
1) Set things up the way you really want them server side, or
2) Run some script client side to rearrange things.

SPServices always takes approach 2, since it's entirely JavaScript. You could probably just clone the function and adapt it to meet your specific needs. There's very little magic there.

M.
Dec 1, 2014 at 4:45 AM
Ok thanks. I will try that and post if I can figure something out

Chris