This project is read-only.

Help with Shape rendering

Topics: Troubleshooting
Sep 9, 2011 at 12:14 PM

Hi, this problem is really driving me up the wall, I'm sure it's something very simple that I'm doing wrong but I cannot for the life of me figure it out!

I have a widget, which is rendering a very simple view, here is the code for the Driver and View


public class CoursePickerDriver : ContentPartDriver<CoursePickerPart>
    private IOrchardServices Services;

    public CoursePickerDriver(IOrchardServices services)
        Services = services;

    protected override DriverResult Display(CoursePickerPart part, string displayType, dynamic shapeHelper)
        CoursePickerWidgetViewModel model = new CoursePickerWidgetViewModel();

        CoursePickerContext context = Context(Services.WorkContext.HttpContext.Request.Path);

        string linkUrl = String.Format("/CoursePicker/{0}#content", context);

        return ContentShape("Parts_CoursePicker", () => shapeHelper.Parts_CoursePicker(LinkUrl: linkUrl));

    private CoursePickerContext Context(string slug)
        foreach (string contextString in Enum.GetNames(typeof(CoursePickerContext)))
            if (slug.ToLowerInvariant().Contains(contextString.ToLowerInvariant()))
                return (CoursePickerContext)Enum.Parse(typeof(CoursePickerContext), contextString);

        return CoursePickerContext.Undergraduate;



    HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
<a href="@Model.LinkUrl" id="nyroCoursePicker" title="CoursePicker">Course Picker</a>

The view file is under the module directory in the folder path ModuleRoot/Views/Parts/CoursePicker.cshtml.

The driver code is definately being run, I can break into it.

The widget is partially displaying, I can see the title of it on the page.

The view however, simply refuses to render. I am at my wits end. Can somebody cleverer than me let me know what I'm doing wrong here!

If you can't see anything wrong with what I've done, some pointers as to how I can debug this issue would be helpful. I've had a brief look into the Orchard code but was frankly slightly overwhelmed.

Thanks in advance.




Sep 9, 2011 at 12:22 PM

change ModuleRoot/Views/Parts/CoursePicker.cshtml



Also have you setup your file? This will determine if it gets rendered or not..

Sep 9, 2011 at 12:32 PM

You legend. I knew it would be something simple! it was. Feel like a right berk now :)

Many Thanks