widget content not showing up

Topics: Writing modules
May 24, 2012 at 9:34 AM

I have interesting issue.

I've created custom widget and all infrastructure for it, but when I added it to the page, the widget shows empty. I try almost everything. Look throw the tutoriaols ones more, nut no result. Please, can anybody help me?

Driver file:

  public class ContactUsWidgetDriver : ContentPartDriver
    {


        //Creates a shape to use when rendering the item in the front end. 
        //Maybe smth to change here
        protected override DriverResult Display(
        ContactUsWidgetPart part, string displayType, dynamic shapeHelper)
        {
            return ContentShape("Parts_ContactUsWidget",
                () => shapeHelper.Parts_ContactUsWidget(
                    Name: null,
                    Company: null,
                    Email: null,
                    Subject: null,
                    Description: null,
                    ContentItem: part.ContentItem
                    ));
        } 

    }

ContactUsWidget.cshtml

<b>I want just to render the content of this view:)</b>
I don't know what to do. Please, help me

Developer
May 24, 2012 at 11:43 AM

Please check:

  1. If you stored the "ContactUsWidget.cshtml" in "Views\Parts"
  2. If you added the shape "Parts_ContactUsWidget" in Placement.info
  3. The logs for any errors (logs are stored in App_data\Logs)

You may also want to try to add another widget, say the Html Widget, just to see that other widgets work.

 

 

May 24, 2012 at 12:05 PM

Thank you for your reply,

Yes, all the points you've listed are correct.

The placement file, and ".cshtml" also are in place and no erros in logs.

Just added HTML widget works fine.

Any more suggestions?

Developer
May 24, 2012 at 12:47 PM

That's odd. Does your driver get hit at all when you set a breakpoint in the Display method?

May 24, 2012 at 12:55 PM

No, it's not hit. I've set the breakpoint and noting happened. The problem is here. 

May 24, 2012 at 2:40 PM

Couple of thoughts...

 

Should this:

public class ContactUsWidgetDriver : ContentPartDriver

Be this:

  public class ContactUsWidgetDriver : ContentPartDriver<ContactUsWidgetPart>

 

?

 

If you add a constructor to your driver and put a break point on it, does that get hit?

May 24, 2012 at 3:04 PM

Thanks for all, the problem was solved. 

It was due to my incorrect View:)

Special thanks for sfmskywalker.

Big thanks, guys!