have you ever tried to pass Custom NavigationData?

Jul 20, 2011 at 2:03 AM

I created a simple class and it's converter add the register in the web.config something like this:

  <sectionGroup name="Navigation">
      <section name="NavigationData" type="PersonConverter, App_Code"/>
    </sectionGroup>

...

....

    <NavigationData>
      <add type="Person, App_Code" />
    </NavigationData>

 

but my code fails here:

    public IEnumerable SearchWithCompletePerson() {
        return from p in _People
               select new {
                   p.Name,
                   p.DateOfBirth,
                   Link = StateController.GetNavigationLink("SelectWithCompletePerson",
                                                            new NavigationData()
                                                                           {
                                                                               {"foo", p}
                                                                           })
               };
    }

It says that my converter it's not implementing the

IConfigurationSectionHandler

but after implementing that interface I still have weird errors, and maybe I'm doing something very wrong.

Cool project by the way, cool code.

Coordinator
Jul 20, 2011 at 8:43 AM

Hi,

Thanks very much for the question and I'm really glad you like the code.

Your sectionGroup is where the error is, it should read as follows:

<sectionGroup name="Navigation">
      <section name="NavigationData" type="Navigation.ConverterInfoSectionHandler, Navigation"/>
</sectionGroup>

You don't need to register your PersonConverter class in the configuration as long as it is specified through the TypeConverter attribute on top of the Person class:

	[TypeConverter(typeof(PersonConverter))]
	public class Person
	{
	}

I hope this helps,

Graham

 

Jul 20, 2011 at 10:24 PM

Thank you very much for your quick answer, you were right, I have my custom navigation data working.