0

I would like to learn about what options I have if I want to design a modal dialog with a wizard that can call custom back-end C# code (I've never done front-end SP development). There seem to be various ways to achieve this and I'd like to evaluate them in terms of simplicity, robustness, ease of deployment etc. For example, I'm trying to produce something like this:

enter image description here
(source: microsoft.com)

but instead of "OK", I plan to have a series of Next/Back buttons that transition between different dialog pages.

A full example of what I'm trying to do: a user clicks on a custom ribbon button and a modal dialog opens, displaying page1 dialog with a question "What kind of feedback would you like to provide?" along with two radio buttons ("Bug report", "Other"). If the user selects "Bug report" and clicks Next, page2 shows up in the same dialog. If he selects "Other", the wizard takes him to page3 with a different look (e.g. a text box for providing details, contact information etc.). What I'd also like is to call custom C# code in the background on a button click. Entered data (text box values, combo box selections ...) can be passed to this code (an assembly method call), which then carries out some actions and returns control to the user.

From the research I've done there seem to be multiple options to do this:

  • develop everything using Visual Studio - seems to require a lot of aspx, xml and js hacking, but is easy to deploy; I'm not sure how easy it is to design the actual wizard;
  • use InfoPath Designer to design a form and display it as a modal dialog (like described here); I'm not sure how good this is deployment-wise; also I only have InfoPath 2013 and VS2010, and even if I create an InfoPath 2010 project, I'm not able to add any custom code to controls as it looks like VS2012 is required ... even if I could, I'm not sure if InfoPath is a good idea for this (due to deployment requirements etc.).
  • use SharePoint Designer - not sure what the verdict is on this one.

What I'd really like is to avoid coding/scripting as much as possible and design each wizard page visually, without having to manually write html and aspx code. A RAD-like approach would be perfect (I'm coming from a WinForms background where you can easily design the interface and also provide code for specific events), but is probably wishful thinking. I know this is a broad question, but would appreciate some directions.

  • Some more info is needed for me to recommend an option. How many site-collections/subsites is this going to be deployed to? I imagine this feedback would be stored in a list. Are you content with having multiple separate lists that have to be managed, or would you be OK with a single list on a central 'feedback site'? Does it have to be a modal dialog, or would you be OK with the ribbon button opening a new page that contained the wizard? – tyshock Feb 4 '14 at 15:17
  • @tyshock: I can't say at this moment how many sites the deployment would span, but I don't want to set an upper limit (other than the one set by SP itself). I'd prefer modal dialog to a new page, but either would be ok if it's a compromise with some benefits. Note that this feedback thing is just an example to illustrate the flow I'm trying to achieve for the user - I'm actually doing a lot more than just that, so I haven't yet decided on where and how things will be stored, but that's a problem I'll consider separately. – w128 Feb 5 '14 at 10:32
1

Since you are coming from Windows Forms environment, I will tell you that Visual Studio way is the bestest way (AFAIK).. Since in Windows Forms you have Forms objects, similarly in SharePoint if you create Visual Web Parts; you have ascx files of the User Controls on which you can drag and drop controls and also you can write Page Events or Control Events (again just like Windows Forms).

You can even use the ASP.NET Wizard Control in a Visual Web Part and add multiple Wizard Steps to achieve what you are looking for.. Following articles should help on how to use Wizard Control:
http://www.4guysfromrolla.com/articles/061406-1.aspx
http://www.codeproject.com/Articles/15804/ASP-NET-2-0-Wizard-Control

The advantage of using Visual Studio is at any point in time you can use SharePoint Object Model to interact with Lists and Libraries.. So let's say you want to save data in List after each Wizard step, you can do that easily..

Since you want it done in a Modal Dialog, you can create a page, drop the Visual Web Part (with Wizard control) and show this page in a Modal Dialog with JavaScript.

  • Thanks, "Visual Web Part" and "Wizard Control" are the keywords that look like will make life a lot easier. :) – w128 Feb 5 '14 at 10:35
  • @w128 I would strongly advise against using the wizard control. It's an old school thing and a pita to work with. Go for the MultiView control instead, it gives you a lot more flexibility and control over it – MdMazzotti Feb 5 '14 at 11:17
  • @MdMazzotti Can you give me a reference where it says MultiView Control is better than Wizard control? Other than just its old :).. No offense, keen to learn.. – Arsalan Adam Khatri Feb 5 '14 at 11:20
  • @ArsalanAdamKhatri oh well, it's just my personal opinion based on practical experience. – MdMazzotti Feb 5 '14 at 11:27
  • @MdMazzotti thanks for the tip, I'll check it out! – w128 Feb 5 '14 at 11:46
2

If you're new to SharePoint development, I can understand your struggling to understand its development model. Responding to UI events by "calling C# code" is possible only with custom webparts or application pages, as no inline-code is allowed in SharePoint Designer by default. You should really first try to determine if what you think will require C# code can instead be done with other means (eg. with the SharePoint javascript library or through a workflow).

As for the wizard-style modal dialog, you may already know that SharePoint 2010 has introduced a dialog framework that you can use in your client-side code (javascript). Here's a detailed introduction about the framework.

As always when I get asked the question "what tool should I use to develop my application in SharePoint", I answer with a somewhat elusive "it depends", but that's really all there's is to say about it. More often than not, a solution in SharePoint is developed by using a range of different tools and techniques. The most difficult skill to acquire about SharePoint development is knowing when to use which tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.